@e-xi/xion 0.0.6
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 +1 -0
- package/dist/bin/icon-generator.d.ts +22 -0
- package/dist/bin/index.d.ts +5 -0
- package/dist/bin/index.js +92 -0
- package/dist/bin/logo-generator.d.ts +22 -0
- package/dist/chunk-files/chunk-34OODP7M.js +147 -0
- package/dist/chunk-files/chunk-3KBZWBNP.js +51 -0
- package/dist/chunk-files/chunk-3R6EJDYR.js +10 -0
- package/dist/chunk-files/chunk-3RVKOFMP.js +68 -0
- package/dist/chunk-files/chunk-3S5OTD47.js +35 -0
- package/dist/chunk-files/chunk-3XB4IEWO.js +195 -0
- package/dist/chunk-files/chunk-3XOVD6UX.js +8 -0
- package/dist/chunk-files/chunk-4HEDNQUP.js +426 -0
- package/dist/chunk-files/chunk-4SSGMLEE.js +934 -0
- package/dist/chunk-files/chunk-5PKWVAQP.js +92 -0
- package/dist/chunk-files/chunk-6BOPFOZD.js +19 -0
- package/dist/chunk-files/chunk-6FDO72PN.js +25 -0
- package/dist/chunk-files/chunk-6X74EPRM.js +0 -0
- package/dist/chunk-files/chunk-B2FI5WI5.js +67 -0
- package/dist/chunk-files/chunk-B7DTBTWQ.js +74 -0
- package/dist/chunk-files/chunk-BFD2LHLK.js +60 -0
- package/dist/chunk-files/chunk-BJOPQNB2.js +319 -0
- package/dist/chunk-files/chunk-BMOLIJ3W.js +89 -0
- package/dist/chunk-files/chunk-BPTFUGTP.js +97 -0
- package/dist/chunk-files/chunk-CSUNGWAE.js +405 -0
- package/dist/chunk-files/chunk-D5ZV4VMI.js +627 -0
- package/dist/chunk-files/chunk-DD6WZ4NY.js +841 -0
- package/dist/chunk-files/chunk-DEODEAKM.js +19 -0
- package/dist/chunk-files/chunk-DRMV3M5V.js +1970 -0
- package/dist/chunk-files/chunk-EQTU45UO.js +21 -0
- package/dist/chunk-files/chunk-F7YTK2MY.js +154 -0
- package/dist/chunk-files/chunk-FMQTZ3QV.js +17 -0
- package/dist/chunk-files/chunk-FPN7JYR4.js +67 -0
- package/dist/chunk-files/chunk-FULHNQ4O.js +1243 -0
- package/dist/chunk-files/chunk-GN2FNR3Z.js +259 -0
- package/dist/chunk-files/chunk-GROGDGEL.js +177 -0
- package/dist/chunk-files/chunk-GUOSVDXA.js +34 -0
- package/dist/chunk-files/chunk-HT5V5A7S.js +6 -0
- package/dist/chunk-files/chunk-ID3YDA2K.js +19 -0
- package/dist/chunk-files/chunk-IH3R2NDR.js +230 -0
- package/dist/chunk-files/chunk-IMGYTSWY.js +261 -0
- package/dist/chunk-files/chunk-J34MOWJP.js +26 -0
- package/dist/chunk-files/chunk-KFK47PDH.js +77 -0
- package/dist/chunk-files/chunk-KFV4GXVE.js +11 -0
- package/dist/chunk-files/chunk-LFHJJQW3.js +723 -0
- package/dist/chunk-files/chunk-LQ67F6EY.js +32 -0
- package/dist/chunk-files/chunk-MJ6Q3TIX.js +703 -0
- package/dist/chunk-files/chunk-OUFO3LM4.js +135 -0
- package/dist/chunk-files/chunk-P4CX6I4J.js +14 -0
- package/dist/chunk-files/chunk-PL5KNBCY.js +78 -0
- package/dist/chunk-files/chunk-PVWRRUOK.js +11 -0
- package/dist/chunk-files/chunk-Q7LCZIQP.js +15 -0
- package/dist/chunk-files/chunk-Q7YMMN7J.js +220 -0
- package/dist/chunk-files/chunk-RAVPJRBA.js +118 -0
- package/dist/chunk-files/chunk-RN7AI33H.js +26 -0
- package/dist/chunk-files/chunk-RODB64YF.js +148 -0
- package/dist/chunk-files/chunk-SVTZ4T6S.js +10 -0
- package/dist/chunk-files/chunk-T3QCAOCO.js +20 -0
- package/dist/chunk-files/chunk-U4XEWVBH.js +19 -0
- package/dist/chunk-files/chunk-UCMR6V67.js +746 -0
- package/dist/chunk-files/chunk-UFYEZIUE.js +1269 -0
- package/dist/chunk-files/chunk-UIJUY7QZ.js +18 -0
- package/dist/chunk-files/chunk-VGDNICVG.js +67 -0
- package/dist/chunk-files/chunk-W2I3I7U7.js +35 -0
- package/dist/chunk-files/chunk-WGYOMA43.js +33 -0
- package/dist/chunk-files/chunk-WKVLVI6N.js +44 -0
- package/dist/chunk-files/chunk-WOJ2UKI7.js +11 -0
- package/dist/chunk-files/chunk-Y3OEXVQ2.js +59 -0
- package/dist/chunk-files/chunk-YLZRRUY7.js +6 -0
- package/dist/chunk-files/chunk-YTHS2ZV7.js +51 -0
- package/dist/chunk-files/chunk-YXAEUJKJ.js +331 -0
- package/dist/chunk-files/chunk-YZOJOLFL.js +121 -0
- package/dist/main/app/app-lifecycle-abstract.d.ts +190 -0
- package/dist/main/app/app-lifecycle.d.ts +7 -0
- package/dist/main/app/icons/icon.ico +0 -0
- package/dist/main/app/index.d.ts +8 -0
- package/dist/main/app/index.js +1226 -0
- package/dist/main/app/types/app.d.ts +74 -0
- package/dist/main/app/xo-app-abstract.d.ts +464 -0
- package/dist/main/app/xo-app.d.ts +23 -0
- package/dist/main/auth/index.d.ts +8 -0
- package/dist/main/auth/index.js +109 -0
- package/dist/main/auth/jwt-auth-manager.d.ts +302 -0
- package/dist/main/auth/jwt-auth-provider-abstract.d.ts +100 -0
- package/dist/main/auth/jwt-auth-refresh-rejected-error.d.ts +12 -0
- package/dist/main/auth/jwt-auth-session-changed-error.d.ts +12 -0
- package/dist/main/auth/types/jwt-auth-manager.d.ts +13 -0
- package/dist/main/banner/banner-abstract.d.ts +38 -0
- package/dist/main/banner/banner-manager.d.ts +20 -0
- package/dist/main/banner/index.d.ts +6 -0
- package/dist/main/banner/index.js +10 -0
- package/dist/main/banner/types/banner.d.ts +17 -0
- package/dist/main/config/app-config.d.ts +6 -0
- package/dist/main/config/index.d.ts +13 -0
- package/dist/main/config/index.js +33 -0
- package/dist/main/config/logger-config.d.ts +6 -0
- package/dist/main/config/remote-service-config.d.ts +6 -0
- package/dist/main/config/tray-config.d.ts +6 -0
- package/dist/main/config/types/app.d.ts +38 -0
- package/dist/main/config/types/logger.d.ts +82 -0
- package/dist/main/config/types/window.d.ts +35 -0
- package/dist/main/config/updater-config.d.ts +6 -0
- package/dist/main/config/window/main-window-config.d.ts +6 -0
- package/dist/main/config/window/setting-window-config.d.ts +6 -0
- package/dist/main/file-association/file-association-handlers-abstract.d.ts +23 -0
- package/dist/main/file-association/file-association-manager-abstract.d.ts +87 -0
- package/dist/main/file-association/file-association-manager.d.ts +13 -0
- package/dist/main/file-association/handlers/app-file-association-handlers.d.ts +12 -0
- package/dist/main/file-association/index.d.ts +8 -0
- package/dist/main/file-association/index.js +13 -0
- package/dist/main/file-association/types/file-association.d.ts +31 -0
- package/dist/main/ipc/handlers/app-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/auth-handlers.d.ts +12 -0
- package/dist/main/ipc/handlers/clipboard-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/contex-menu-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/dialog-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/file-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/log-handlers.d.ts +45 -0
- package/dist/main/ipc/handlers/remote-service-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/shell-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/theme-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/updater-handlers.d.ts +13 -0
- package/dist/main/ipc/handlers/window-handlers.d.ts +13 -0
- package/dist/main/ipc/index.d.ts +20 -0
- package/dist/main/ipc/index.js +60 -0
- package/dist/main/ipc/ipc-handlers-abstract.d.ts +23 -0
- package/dist/main/ipc/ipc-manager-abstract.d.ts +46 -0
- package/dist/main/ipc/ipc-manager.d.ts +13 -0
- package/dist/main/ipc/types/ipc-handler.d.ts +22 -0
- package/dist/main/ipc/utils/ipc-handler-util.d.ts +24 -0
- package/dist/main/logger/index.d.ts +4 -0
- package/dist/main/logger/index.js +13 -0
- package/dist/main/logger/xo-logger.d.ts +113 -0
- package/dist/main/menu/consts/menu-type.d.ts +1 -0
- package/dist/main/menu/index.d.ts +8 -0
- package/dist/main/menu/index.js +28 -0
- package/dist/main/menu/menu-items.d.ts +192 -0
- package/dist/main/menu/menu-manager-abstract.d.ts +273 -0
- package/dist/main/menu/menu-manager.d.ts +12 -0
- package/dist/main/menu/types/menu.d.ts +101 -0
- package/dist/main/mode/app-mode.d.ts +32 -0
- package/dist/main/mode/index.d.ts +5 -0
- package/dist/main/mode/index.js +9 -0
- package/dist/main/mode/types/mode.d.ts +25 -0
- package/dist/main/protocol/consts/protocol-keys.d.ts +10 -0
- package/dist/main/protocol/handlers/app-protocol-handlers.d.ts +12 -0
- package/dist/main/protocol/index.d.ts +9 -0
- package/dist/main/protocol/index.js +15 -0
- package/dist/main/protocol/protocol-handlers-abstract.d.ts +23 -0
- package/dist/main/protocol/protocol-manager-abstract.d.ts +85 -0
- package/dist/main/protocol/protocol-manager.d.ts +13 -0
- package/dist/main/protocol/types/protocol.d.ts +33 -0
- package/dist/main/remote-service/consts/remote-service-methods.d.ts +5 -0
- package/dist/main/remote-service/index.d.ts +7 -0
- package/dist/main/remote-service/index.js +17 -0
- package/dist/main/remote-service/remote-service-manager-abstract.d.ts +303 -0
- package/dist/main/remote-service/remote-service-manager.d.ts +7 -0
- package/dist/main/remote-service/types/remote-service.d.ts +9 -0
- package/dist/main/renderer-protocol/handlers/renderer-remote-service-protocol-handlers.d.ts +130 -0
- package/dist/main/renderer-protocol/handlers/renderer-root-protocol-handlers.d.ts +65 -0
- package/dist/main/renderer-protocol/index.d.ts +9 -0
- package/dist/main/renderer-protocol/index.js +18 -0
- package/dist/main/renderer-protocol/renderer-protocol-handlers-abstract.d.ts +23 -0
- package/dist/main/renderer-protocol/renderer-protocol-manager-abstract.d.ts +78 -0
- package/dist/main/renderer-protocol/renderer-protocol-manager.d.ts +13 -0
- package/dist/main/renderer-protocol/types/renderer-protocol.d.ts +34 -0
- package/dist/main/shortcut/handlers/app-shortcut-handlers.d.ts +11 -0
- package/dist/main/shortcut/handlers/window-shortcut-handlers.d.ts +11 -0
- package/dist/main/shortcut/index.d.ts +9 -0
- package/dist/main/shortcut/index.js +17 -0
- package/dist/main/shortcut/shortcut-handlers-abstract.d.ts +18 -0
- package/dist/main/shortcut/shortcut-manager-abstract.d.ts +121 -0
- package/dist/main/shortcut/shortcut-manager.d.ts +12 -0
- package/dist/main/shortcut/types/shortcut.d.ts +50 -0
- package/dist/main/store/app-store.d.ts +179 -0
- package/dist/main/store/index.d.ts +7 -0
- package/dist/main/store/index.js +13 -0
- package/dist/main/store/jwt-auth-store.d.ts +36 -0
- package/dist/main/store/types/app-store.d.ts +46 -0
- package/dist/main/store/types/jwt-auth-store.d.ts +14 -0
- package/dist/main/theme/consts/theme-sources.d.ts +10 -0
- package/dist/main/theme/index.d.ts +7 -0
- package/dist/main/theme/index.js +16 -0
- package/dist/main/theme/theme-manager-abstract.d.ts +93 -0
- package/dist/main/theme/theme-manager.d.ts +7 -0
- package/dist/main/theme/types/theme.d.ts +38 -0
- package/dist/main/tray/consts/tray-animation-name.d.ts +1 -0
- package/dist/main/tray/consts/tray-icon-name.d.ts +1 -0
- package/dist/main/tray/icons/blur.ico +0 -0
- package/dist/main/tray/icons/error.ico +0 -0
- package/dist/main/tray/icons/focus.ico +0 -0
- package/dist/main/tray/icons/none.ico +0 -0
- package/dist/main/tray/icons/offline.ico +0 -0
- package/dist/main/tray/icons/online.ico +0 -0
- package/dist/main/tray/icons/success.ico +0 -0
- package/dist/main/tray/index.d.ts +11 -0
- package/dist/main/tray/index.js +27 -0
- package/dist/main/tray/tray-animation.d.ts +48 -0
- package/dist/main/tray/tray-icon.d.ts +51 -0
- package/dist/main/tray/tray-lifecycle-abstract.d.ts +154 -0
- package/dist/main/tray/tray-lifecycle.d.ts +7 -0
- package/dist/main/tray/tray-manager.d.ts +173 -0
- package/dist/main/tray/types/tray.d.ts +81 -0
- package/dist/main/updater/dev-app-update.yml +5 -0
- package/dist/main/updater/index.d.ts +6 -0
- package/dist/main/updater/index.js +20 -0
- package/dist/main/updater/types/updater.d.ts +167 -0
- package/dist/main/updater/updater-manager-abstract.d.ts +237 -0
- package/dist/main/updater/updater-manager.d.ts +7 -0
- package/dist/main/utils/file-association-util.d.ts +43 -0
- package/dist/main/utils/index.d.ts +14 -0
- package/dist/main/utils/index.js +105 -0
- package/dist/main/utils/menu-util.d.ts +12 -0
- package/dist/main/utils/protocol-util.d.ts +49 -0
- package/dist/main/utils/runtime-config-util.d.ts +75 -0
- package/dist/main/utils/shortcut-util.d.ts +38 -0
- package/dist/main/utils/tray-util.d.ts +18 -0
- package/dist/main/utils/window-util.d.ts +55 -0
- package/dist/main/utils/xo-app-root-util.d.ts +30 -0
- package/dist/main/utils/xo-app-util.d.ts +24 -0
- package/dist/main/utils/xo-path-util.d.ts +59 -0
- package/dist/main/utils/xo-util.d.ts +17 -0
- package/dist/main/window/index.d.ts +10 -0
- package/dist/main/window/index.js +36 -0
- package/dist/main/window/main/main-window-lifecycle.d.ts +7 -0
- package/dist/main/window/main/main-window-type.d.ts +5 -0
- package/dist/main/window/setting/setting-window-lifecycle.d.ts +7 -0
- package/dist/main/window/setting/setting-window-type.d.ts +5 -0
- package/dist/main/window/types/window.d.ts +86 -0
- package/dist/main/window/window-lifecycle-abstract.d.ts +514 -0
- package/dist/main/window/window-manager.d.ts +422 -0
- package/dist/preload/bridge/bridge-abstract.d.ts +11 -0
- package/dist/preload/bridge/bridge.d.ts +35 -0
- package/dist/preload/bridge/index.d.ts +6 -0
- package/dist/preload/bridge/index.js +117 -0
- package/dist/preload/bridge/preload.cjs +1706 -0
- package/dist/preload/bridge/preload.internal.d.ts +1 -0
- package/dist/preload/bridge/types/bridge.d.ts +19 -0
- package/dist/preload/bridges/app/app-bridge.d.ts +142 -0
- package/dist/preload/bridges/app/types/app.d.ts +65 -0
- package/dist/preload/bridges/auth/auth-bridge.d.ts +36 -0
- package/dist/preload/bridges/auth/types/auth.d.ts +23 -0
- package/dist/preload/bridges/clipboard/clipboard-bridge.d.ts +37 -0
- package/dist/preload/bridges/clipboard/types/clipboard.d.ts +23 -0
- package/dist/preload/bridges/context-menu/context-menu-bridge.d.ts +27 -0
- package/dist/preload/bridges/context-menu/types/context-menu.d.ts +19 -0
- package/dist/preload/bridges/dialog/dialog-bridge.d.ts +30 -0
- package/dist/preload/bridges/dialog/types/dialog.d.ts +41 -0
- package/dist/preload/bridges/file/file-bridge.d.ts +34 -0
- package/dist/preload/bridges/file/types/file.d.ts +21 -0
- package/dist/preload/bridges/index.d.ts +29 -0
- package/dist/preload/bridges/index.js +40 -0
- package/dist/preload/bridges/ipc/ipc-bridge.d.ts +43 -0
- package/dist/preload/bridges/ipc/types/ipc.d.ts +23 -0
- package/dist/preload/bridges/log/log-bridge.d.ts +52 -0
- package/dist/preload/bridges/log/types/log.d.ts +20 -0
- package/dist/preload/bridges/remote-service/remote-service-bridge.d.ts +55 -0
- package/dist/preload/bridges/remote-service/types/remote-service.d.ts +29 -0
- package/dist/preload/bridges/shell/shell-bridge.d.ts +27 -0
- package/dist/preload/bridges/shell/types/shell.d.ts +19 -0
- package/dist/preload/bridges/theme/theme-bridge.d.ts +32 -0
- package/dist/preload/bridges/theme/types/theme.d.ts +21 -0
- package/dist/preload/bridges/updater/types/updater.d.ts +35 -0
- package/dist/preload/bridges/updater/updater-bridge.d.ts +66 -0
- package/dist/preload/bridges/window/internal/route-redirect-buffer.d.ts +36 -0
- package/dist/preload/bridges/window/types/window.d.ts +53 -0
- package/dist/preload/bridges/window/window-bridge.d.ts +118 -0
- package/dist/preload/utils/bridge-util.d.ts +43 -0
- package/dist/preload/utils/index.d.ts +4 -0
- package/dist/preload/utils/index.js +7 -0
- package/dist/renderer/app/bootstrap-renderer.d.ts +6 -0
- package/dist/renderer/app/index.d.ts +5 -0
- package/dist/renderer/app/index.js +164 -0
- package/dist/renderer/app/styles-element-plus.internal.d.ts +2 -0
- package/dist/renderer/app/styles-xion.internal.d.ts +2 -0
- package/dist/renderer/app/types/app.d.ts +51 -0
- package/dist/renderer/components/captcha/internal/captcha-controller.d.ts +280 -0
- package/dist/renderer/components/captcha/internal/captcha-css-property.d.ts +25 -0
- package/dist/renderer/components/captcha/internal/captcha-defaults.d.ts +33 -0
- package/dist/renderer/components/captcha/internal/captcha-errors.d.ts +21 -0
- package/dist/renderer/components/captcha/internal/captcha-helper.d.ts +72 -0
- package/dist/renderer/components/captcha/internal/captcha-injector.d.ts +16 -0
- package/dist/renderer/components/captcha/internal/captcha-runtime-types.d.ts +153 -0
- package/dist/renderer/components/captcha/internal/captcha-service.d.ts +22 -0
- package/dist/renderer/components/captcha/internal/captcha-slide-types.d.ts +62 -0
- package/dist/renderer/components/captcha/internal/captcha-ui-patch.d.ts +43 -0
- package/dist/renderer/components/captcha/internal/captcha-wasm-loader.d.ts +36 -0
- package/dist/renderer/components/captcha/style/index.less +132 -0
- package/dist/renderer/components/captcha/types/captcha.d.ts +132 -0
- package/dist/renderer/components/captcha/xo-captcha-host.vue +151 -0
- package/dist/renderer/components/captcha/xo-captcha.vue +83 -0
- package/dist/renderer/components/captcha.d.ts +40 -0
- package/dist/renderer/components/context-menu/types/context-menu.d.ts +55 -0
- package/dist/renderer/components/context-menu/xo-context-menu-items.vue +112 -0
- package/dist/renderer/components/context-menu/xo-context-menu.vue +356 -0
- package/dist/renderer/components/context-menu.d.ts +32 -0
- package/dist/renderer/components/divider/types/divider.d.ts +31 -0
- package/dist/renderer/components/divider/xo-divider.vue +176 -0
- package/dist/renderer/components/form/types/form-flex-row.d.ts +21 -0
- package/dist/renderer/components/form/types/form-flex.d.ts +49 -0
- package/dist/renderer/components/form/xo-form-flex-row.vue +122 -0
- package/dist/renderer/components/form/xo-form-flex.vue +115 -0
- package/dist/renderer/components/index.d.ts +70 -0
- package/dist/renderer/components/index.js +1282 -0
- package/dist/renderer/components/layouts/types/app-layout.d.ts +29 -0
- package/dist/renderer/components/layouts/types/mini-layout.d.ts +23 -0
- package/dist/renderer/components/layouts/types/simple-layout.d.ts +17 -0
- package/dist/renderer/components/layouts/xo-app-layout.vue +350 -0
- package/dist/renderer/components/layouts/xo-mini-layout.vue +207 -0
- package/dist/renderer/components/layouts/xo-simple-layout.vue +43 -0
- package/dist/renderer/components/pages/types/app-page.d.ts +25 -0
- package/dist/renderer/components/pages/types/bootstrap-page.d.ts +35 -0
- package/dist/renderer/components/pages/types/dynamic-page.d.ts +20 -0
- package/dist/renderer/components/pages/types/settings-page.d.ts +23 -0
- package/dist/renderer/components/pages/xo-app-page.vue +230 -0
- package/dist/renderer/components/pages/xo-bootstrap-page.vue +93 -0
- package/dist/renderer/components/pages/xo-dynamic-page.vue +28 -0
- package/dist/renderer/components/pages/xo-settings-page.vue +143 -0
- package/dist/renderer/components/radio-group/types/radio-group.d.ts +30 -0
- package/dist/renderer/components/radio-group/xo-radio-group.vue +38 -0
- package/dist/renderer/components/service-status-bar/types/service-status-bar.d.ts +65 -0
- package/dist/renderer/components/service-status-bar/xo-service-status-bar.vue +193 -0
- package/dist/renderer/components/settings-components/types/setting-app-opacity.d.ts +19 -0
- package/dist/renderer/components/settings-components/types/setting-log-level.d.ts +23 -0
- package/dist/renderer/components/settings-components/types/setting-shortcut-keys-record-for-form-flex-rows.d.ts +47 -0
- package/dist/renderer/components/settings-components/types/setting-shortcut-keys-record.d.ts +23 -0
- package/dist/renderer/components/settings-components/types/setting-window-material.d.ts +23 -0
- package/dist/renderer/components/settings-components/xo-setting-app-opacity.vue +105 -0
- package/dist/renderer/components/settings-components/xo-setting-log-level.vue +84 -0
- package/dist/renderer/components/settings-components/xo-setting-shortcut-keys-record-for-form-flex-rows.vue +37 -0
- package/dist/renderer/components/settings-components/xo-setting-shortcut-keys-record.vue +74 -0
- package/dist/renderer/components/settings-components/xo-setting-window-material.vue +83 -0
- package/dist/renderer/components/settings-pages/types/setting-page-folder.d.ts +41 -0
- package/dist/renderer/components/settings-pages/types/setting-page-general.d.ts +23 -0
- package/dist/renderer/components/settings-pages/types/setting-page-remote-service.d.ts +19 -0
- package/dist/renderer/components/settings-pages/types/setting-page-updater.d.ts +27 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-folder.vue +137 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-general.vue +255 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-remote-service.vue +183 -0
- package/dist/renderer/components/settings-pages/xo-setting-page-updater.vue +350 -0
- package/dist/renderer/components/shortcut-keys-record/types/shortcut-keys-record.d.ts +25 -0
- package/dist/renderer/components/shortcut-keys-record/xo-shortcut-keys-record.vue +161 -0
- package/dist/renderer/components/side-bar/types/sidebar-logo.d.ts +39 -0
- package/dist/renderer/components/side-bar/xo-sidebar-logo.vue +133 -0
- package/dist/renderer/components/spacing-line/types/spacing-line.d.ts +17 -0
- package/dist/renderer/components/spacing-line/xo-spacing-line.vue +53 -0
- package/dist/renderer/components/theme-switch/types/theme-switch-mini.d.ts +21 -0
- package/dist/renderer/components/theme-switch/types/theme-switch.d.ts +45 -0
- package/dist/renderer/components/theme-switch/xo-theme-switch-mini.vue +93 -0
- package/dist/renderer/components/theme-switch/xo-theme-switch.vue +200 -0
- package/dist/renderer/components/title-bar/types/title-bar.d.ts +58 -0
- package/dist/renderer/components/title-bar/xo-title-bar.vue +364 -0
- package/dist/renderer/components/types/sidebar-menu.d.ts +37 -0
- package/dist/renderer/components/types/vue.d.ts +9 -0
- package/dist/renderer/components/updater/types/updater.d.ts +97 -0
- package/dist/renderer/components/updater/xo-updater.vue +1190 -0
- package/dist/renderer/components/window-control/types/window-control.d.ts +17 -0
- package/dist/renderer/components/window-control/xo-window-control.vue +193 -0
- package/dist/renderer/composables/index.d.ts +7 -0
- package/dist/renderer/composables/index.js +570 -0
- package/dist/renderer/composables/use-xo-boolean.d.ts +14 -0
- package/dist/renderer/composables/use-xo-data-loader.d.ts +73 -0
- package/dist/renderer/composables/use-xo-form-control.d.ts +84 -0
- package/dist/renderer/composables/use-xo-updater-action.d.ts +25 -0
- package/dist/renderer/global/index.d.ts +4 -0
- package/dist/renderer/global/index.js +0 -0
- package/dist/renderer/global/types/window.d.ts +21 -0
- package/dist/renderer/icons/demo.css +539 -0
- package/dist/renderer/icons/iconfont.css +490 -0
- package/dist/renderer/services/index.d.ts +6 -0
- package/dist/renderer/services/index.js +444 -0
- package/dist/renderer/services/orval-axios-mutator.d.ts +9 -0
- package/dist/renderer/services/types/xo-api.d.ts +92 -0
- package/dist/renderer/services/xo-api-requester.d.ts +129 -0
- package/dist/renderer/store/app/app-store.d.ts +68 -0
- package/dist/renderer/store/auth/auth-store.d.ts +43 -0
- package/dist/renderer/store/index.d.ts +9 -0
- package/dist/renderer/store/index.js +595 -0
- package/dist/renderer/store/remote-service/remote-service-store.d.ts +52 -0
- package/dist/renderer/store/theme/theme-store.d.ts +52 -0
- package/dist/renderer/store/updater/updater-store.d.ts +88 -0
- package/dist/renderer/store/window/window-store.d.ts +58 -0
- package/dist/renderer/styles/css/element-plus.less +280 -0
- package/dist/renderer/styles/css/iconfont-patch.less +6 -0
- package/dist/renderer/styles/css/reset.less +83 -0
- package/dist/renderer/styles/css/scrollbar.less +56 -0
- package/dist/renderer/styles/index.less +35 -0
- package/dist/renderer/styles/mixin.less +144 -0
- package/dist/renderer/styles/var/element-plus/dark.less +32 -0
- package/dist/renderer/styles/var/element-plus/root.less +88 -0
- package/dist/renderer/styles/var/global/dark.less +10 -0
- package/dist/renderer/styles/var/global/root.less +46 -0
- package/dist/renderer/styles/var/layout/dark.less +7 -0
- package/dist/renderer/styles/var/layout/root.less +9 -0
- package/dist/renderer/styles/var/scrollbar/dark.less +13 -0
- package/dist/renderer/styles/var/scrollbar/root.less +35 -0
- package/dist/renderer/utils/auth-route-util.d.ts +117 -0
- package/dist/renderer/utils/context-util.d.ts +13 -0
- package/dist/renderer/utils/error-util.d.ts +12 -0
- package/dist/renderer/utils/index.d.ts +14 -0
- package/dist/renderer/utils/index.js +1522 -0
- package/dist/renderer/utils/keyboard-util.d.ts +86 -0
- package/dist/renderer/utils/message-util.d.ts +161 -0
- package/dist/renderer/utils/renderer-log-util.d.ts +44 -0
- package/dist/renderer/utils/renderer-util.d.ts +37 -0
- package/dist/renderer/utils/router-util.d.ts +186 -0
- package/dist/renderer/utils/shortcut-util.d.ts +20 -0
- package/dist/renderer/utils/storage-util.d.ts +85 -0
- package/dist/renderer/utils/types/vue-router.d.ts +17 -0
- package/dist/shared/app/consts/app-launch-mode.d.ts +9 -0
- package/dist/shared/app/consts/update-mode.d.ts +8 -0
- package/dist/shared/app/consts/window-close-behavior.d.ts +8 -0
- package/dist/shared/app/consts/window-material.d.ts +8 -0
- package/dist/shared/app/consts/xion-name.d.ts +5 -0
- package/dist/shared/app/electron-app-config.d.ts +5 -0
- package/dist/shared/app/index.d.ts +16 -0
- package/dist/shared/app/index.js +30 -0
- package/dist/shared/app/types/app-info.d.ts +32 -0
- package/dist/shared/app/types/app-launch-mode.d.ts +13 -0
- package/dist/shared/app/types/app-paths.d.ts +27 -0
- package/dist/shared/app/types/general-settings.d.ts +27 -0
- package/dist/shared/app/types/on-window-close.d.ts +13 -0
- package/dist/shared/app/types/update-mode.d.ts +13 -0
- package/dist/shared/app/types/window-material.d.ts +2 -0
- package/dist/shared/auth/const/auth-status.d.ts +2 -0
- package/dist/shared/auth/index.d.ts +5 -0
- package/dist/shared/auth/index.js +5 -0
- package/dist/shared/auth/types/auth.d.ts +78 -0
- package/dist/shared/color/consts/color.d.ts +5 -0
- package/dist/shared/color/index.d.ts +5 -0
- package/dist/shared/color/index.js +6 -0
- package/dist/shared/color/types/color.d.ts +26 -0
- package/dist/shared/electron-builder/index.d.ts +4 -0
- package/dist/shared/electron-builder/index.js +0 -0
- package/dist/shared/electron-builder/types/electron-builder-options.d.ts +34 -0
- package/dist/shared/errors/index.d.ts +4 -0
- package/dist/shared/errors/index.js +10 -0
- package/dist/shared/errors/ipc-invoke-error.d.ts +32 -0
- package/dist/shared/ipc/channels/app-channels.d.ts +56 -0
- package/dist/shared/ipc/channels/auth-channels.d.ts +14 -0
- package/dist/shared/ipc/channels/clipboard-channels.d.ts +14 -0
- package/dist/shared/ipc/channels/context-menu-channels.d.ts +10 -0
- package/dist/shared/ipc/channels/dialog-channels.d.ts +12 -0
- package/dist/shared/ipc/channels/file-channels.d.ts +12 -0
- package/dist/shared/ipc/channels/log-channels.d.ts +14 -0
- package/dist/shared/ipc/channels/remote-service-channels.d.ts +20 -0
- package/dist/shared/ipc/channels/shell-channels.d.ts +10 -0
- package/dist/shared/ipc/channels/theme-channels.d.ts +12 -0
- package/dist/shared/ipc/channels/updater-channels.d.ts +26 -0
- package/dist/shared/ipc/channels/window-channels.d.ts +44 -0
- package/dist/shared/ipc/consts/ipc-channel.d.ts +1 -0
- package/dist/shared/ipc/index.d.ts +19 -0
- package/dist/shared/ipc/index.js +46 -0
- package/dist/shared/ipc/ipc-result.d.ts +20 -0
- package/dist/shared/ipc/types/ipc-logger.d.ts +27 -0
- package/dist/shared/ipc/types/ipc.d.ts +61 -0
- package/dist/shared/logger/consts/log-levels.d.ts +14 -0
- package/dist/shared/logger/index.d.ts +4 -0
- package/dist/shared/logger/index.js +10 -0
- package/dist/shared/menu/consts/menu-command.d.ts +1 -0
- package/dist/shared/menu/index.d.ts +6 -0
- package/dist/shared/menu/index.js +10 -0
- package/dist/shared/menu/menu-command.d.ts +24 -0
- package/dist/shared/menu/types/menu.d.ts +72 -0
- package/dist/shared/mode/consts/command.d.ts +10 -0
- package/dist/shared/mode/consts/mode.d.ts +22 -0
- package/dist/shared/mode/index.d.ts +5 -0
- package/dist/shared/mode/index.js +18 -0
- package/dist/shared/remote-service/const/remote-service.d.ts +8 -0
- package/dist/shared/remote-service/index.d.ts +5 -0
- package/dist/shared/remote-service/index.js +38 -0
- package/dist/shared/remote-service/types/remote-service.d.ts +146 -0
- package/dist/shared/renderer/index.d.ts +7 -0
- package/dist/shared/renderer/index.js +0 -0
- package/dist/shared/renderer/types/element-plus.d.ts +20 -0
- package/dist/shared/renderer/types/input.d.ts +11 -0
- package/dist/shared/renderer/types/options.d.ts +22 -0
- package/dist/shared/renderer/types/switch.d.ts +11 -0
- package/dist/shared/renderer-protocol/consts/renderer-protocol-keys.d.ts +10 -0
- package/dist/shared/renderer-protocol/index.d.ts +5 -0
- package/dist/shared/renderer-protocol/index.js +6 -0
- package/dist/shared/renderer-protocol/types/renderer-protocol.d.ts +7 -0
- package/dist/shared/runtime/index.d.ts +4 -0
- package/dist/shared/runtime/index.js +0 -0
- package/dist/shared/runtime/types/runtime.d.ts +20 -0
- package/dist/shared/shortcut/consts/shortcut-handler-ids.d.ts +9 -0
- package/dist/shared/shortcut/consts/shortcut-id.d.ts +1 -0
- package/dist/shared/shortcut/index.d.ts +6 -0
- package/dist/shared/shortcut/index.js +10 -0
- package/dist/shared/shortcut/types/shortcut.d.ts +13 -0
- package/dist/shared/utils/bytes-util.d.ts +16 -0
- package/dist/shared/utils/index.d.ts +15 -0
- package/dist/shared/utils/index.js +42 -0
- package/dist/shared/utils/ipc-util.d.ts +12 -0
- package/dist/shared/utils/log-util.d.ts +33 -0
- package/dist/shared/utils/menu-util.d.ts +12 -0
- package/dist/shared/utils/number-util.d.ts +12 -0
- package/dist/shared/utils/object-util.d.ts +88 -0
- package/dist/shared/utils/regexp-util.d.ts +22 -0
- package/dist/shared/utils/shortcut-util.d.ts +12 -0
- package/dist/shared/utils/string-util.d.ts +14 -0
- package/dist/shared/utils/time-util.d.ts +32 -0
- package/dist/shared/utils/validator-util.d.ts +12 -0
- package/dist/shared/utils/window-shared-util.d.ts +26 -0
- package/dist/shared/window/consts/window-record-id.d.ts +2 -0
- package/dist/shared/window/consts/window-type-name.d.ts +1 -0
- package/dist/shared/window/identity/main-window-identity.d.ts +5 -0
- package/dist/shared/window/identity/setting-window-identity.d.ts +5 -0
- package/dist/shared/window/index.d.ts +8 -0
- package/dist/shared/window/index.js +23 -0
- package/dist/shared/window/types/window.d.ts +84 -0
- package/dist/types/index.d.ts +102 -0
- package/dist/types/index.js +0 -0
- package/dist/vite/build/build-chunk.d.ts +53 -0
- package/dist/vite/build/build-csp-update.d.ts +80 -0
- package/dist/vite/build/build-obfuscation.d.ts +33 -0
- package/dist/vite/build/component-map.d.ts +38 -0
- package/dist/vite/build/component-resolver.d.ts +6 -0
- package/dist/vite/build/index.d.ts +9 -0
- package/dist/vite/build/index.js +18 -0
- package/dist/vite/build/types/build.d.ts +13 -0
- package/dist/vite/config/electron-app-config.d.ts +6 -0
- package/dist/vite/config/electron-builder-config.d.ts +8 -0
- package/dist/vite/config/electron-vite-config.d.ts +9 -0
- package/dist/vite/config/index.d.ts +11 -0
- package/dist/vite/config/index.js +2259 -0
- package/dist/vite/config/types/electron-app-options.d.ts +22 -0
- package/dist/vite/config/types/electron-builder-options.d.ts +16 -0
- package/dist/vite/config/types/electron-vite-options.d.ts +43 -0
- package/dist/vite/config/types/vite-obfuscation.d.ts +36 -0
- package/dist/vite/config/vite-obfuscation-config.d.ts +6 -0
- package/dist/vite/mode/index.d.ts +4 -0
- package/dist/vite/mode/index.js +8 -0
- package/dist/vite/mode/vite-mode.d.ts +37 -0
- package/dist/vite/orval/index.d.ts +4 -0
- package/dist/vite/orval/index.js +75 -0
- package/dist/vite/orval/orval-global-types.d.ts +23 -0
- package/dist/vite/utils/file-write-vite-util.d.ts +30 -0
- package/dist/vite/utils/index.d.ts +5 -0
- package/dist/vite/utils/index.js +10 -0
- package/dist/vite/utils/runtime-config-vite-util.d.ts +39 -0
- package/package.json +287 -0
|
@@ -0,0 +1,2259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FileWriteViteUtil
|
|
3
|
+
} from "../../chunk-files/chunk-YTHS2ZV7.js";
|
|
4
|
+
import {
|
|
5
|
+
BuildChunk,
|
|
6
|
+
BuildCspUpdate,
|
|
7
|
+
BuildObfuscation,
|
|
8
|
+
XionComponentMap,
|
|
9
|
+
XionComponentResolver
|
|
10
|
+
} from "../../chunk-files/chunk-CSUNGWAE.js";
|
|
11
|
+
import {
|
|
12
|
+
ViteMode
|
|
13
|
+
} from "../../chunk-files/chunk-B2FI5WI5.js";
|
|
14
|
+
import "../../chunk-files/chunk-3XOVD6UX.js";
|
|
15
|
+
import {
|
|
16
|
+
defaultElectronAppConfig
|
|
17
|
+
} from "../../chunk-files/chunk-DEODEAKM.js";
|
|
18
|
+
import "../../chunk-files/chunk-OUFO3LM4.js";
|
|
19
|
+
import "../../chunk-files/chunk-6FDO72PN.js";
|
|
20
|
+
import "../../chunk-files/chunk-U4XEWVBH.js";
|
|
21
|
+
import "../../chunk-files/chunk-BMOLIJ3W.js";
|
|
22
|
+
import "../../chunk-files/chunk-6BOPFOZD.js";
|
|
23
|
+
import "../../chunk-files/chunk-ID3YDA2K.js";
|
|
24
|
+
import "../../chunk-files/chunk-FPN7JYR4.js";
|
|
25
|
+
import {
|
|
26
|
+
ObjectUtil
|
|
27
|
+
} from "../../chunk-files/chunk-RODB64YF.js";
|
|
28
|
+
import {
|
|
29
|
+
RuntimeConfigViteUtil
|
|
30
|
+
} from "../../chunk-files/chunk-3RVKOFMP.js";
|
|
31
|
+
import "../../chunk-files/chunk-FMQTZ3QV.js";
|
|
32
|
+
|
|
33
|
+
// src/vite/config/electron-app-config.ts
|
|
34
|
+
var defineElectronAppConfig = (override) => {
|
|
35
|
+
return ObjectUtil.merge(
|
|
36
|
+
defaultElectronAppConfig(),
|
|
37
|
+
override,
|
|
38
|
+
{
|
|
39
|
+
array: "override",
|
|
40
|
+
object: "recursive",
|
|
41
|
+
undefined: "skip",
|
|
42
|
+
null: "override"
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/vite/config/electron-builder-config.ts
|
|
48
|
+
import fs from "node:fs";
|
|
49
|
+
import path from "node:path";
|
|
50
|
+
var defaultConfig = (options) => {
|
|
51
|
+
const { rootDir, electronAppConfig } = options;
|
|
52
|
+
const packageJson = parsePackageJson(rootDir);
|
|
53
|
+
return {
|
|
54
|
+
// 应用唯一标识
|
|
55
|
+
appId: electronAppConfig.appId,
|
|
56
|
+
// 展示名称,可包含空格;用于程序名称、安装包名称等
|
|
57
|
+
productName: electronAppConfig.productName,
|
|
58
|
+
// 文件属性和安装包中的版权信息
|
|
59
|
+
copyright: packageJson.copyright?.trim() || void 0,
|
|
60
|
+
// 是否将应用代码打包进 app.asar
|
|
61
|
+
asar: true,
|
|
62
|
+
// 指定不能放入 ASAR、必须解压到 app.asar.unpacked 的文件
|
|
63
|
+
// asarUnpack: undefined,
|
|
64
|
+
// 发布信息选项
|
|
65
|
+
releaseInfo: {
|
|
66
|
+
// 发布名称
|
|
67
|
+
releaseName: electronAppConfig.productName,
|
|
68
|
+
// 发布说明
|
|
69
|
+
releaseNotes: serializeReleaseNotes(packageJson.$releaseNotes)
|
|
70
|
+
},
|
|
71
|
+
// 最终安装包文件名模板(一般保持默认即可),支持 ${productName}、${version}、${arch}、${ext}
|
|
72
|
+
artifactName: "${productName}_setup_${version}.${ext}",
|
|
73
|
+
// 目录选项(一般保持默认即可)
|
|
74
|
+
directories: {
|
|
75
|
+
// 构建产物输出目录,通常为 dist,会生成安装包、更新文件等:
|
|
76
|
+
// └─ dist/
|
|
77
|
+
// ├─ EAssistant_setup_0.1.1.exe
|
|
78
|
+
// ├─ EAssistant_setup_0.1.1.exe.blockmap
|
|
79
|
+
// └─ latest.yml
|
|
80
|
+
// 支持文件宏,如 'dist/${version}'
|
|
81
|
+
output: "dist",
|
|
82
|
+
// 构建资源目录,存放仅在打包阶段使用的资源,通常为 build,可以包含文件、图标等:
|
|
83
|
+
// └─ build/
|
|
84
|
+
// ├─ icons/
|
|
85
|
+
// │ └─ icon.ico
|
|
86
|
+
// ├─ installerHeader.bmp
|
|
87
|
+
// └─ release-notes.md
|
|
88
|
+
buildResources: "build"
|
|
89
|
+
// 待打包应用所在目录,这个目录应包含应用的 package.json
|
|
90
|
+
// 默认情况下 electron-builder 会依次考虑:app/ www/ 项目根目录/
|
|
91
|
+
// 如果项目 package.json 就在项目根目录,不用设置,否则会产生警告
|
|
92
|
+
// app: undefined,
|
|
93
|
+
},
|
|
94
|
+
// 文件复制进 resources/app.asar
|
|
95
|
+
// 支持 {from: '源目录', to: '目标目录', filter: ['**/*', '!忽略项']}
|
|
96
|
+
files: [
|
|
97
|
+
"out/**/*",
|
|
98
|
+
"package.json"
|
|
99
|
+
],
|
|
100
|
+
// 文件复制进 resources/
|
|
101
|
+
// 支持 {from: '源目录', to: '目标目录', filter: ['**/*', '!忽略项']}
|
|
102
|
+
extraResources: [],
|
|
103
|
+
// 文件复制进应用安装根目录
|
|
104
|
+
// 支持 {from: '源目录', to: '目标目录', filter: ['**/*', '!忽略项']}
|
|
105
|
+
extraFiles: [],
|
|
106
|
+
// 用来修改或补充打包后应用内部的 package.json 中的字段
|
|
107
|
+
extraMetadata: {
|
|
108
|
+
// 修改 package.json 中的 main 字段
|
|
109
|
+
main: "out/main/index.js"
|
|
110
|
+
},
|
|
111
|
+
// 更新发布选项
|
|
112
|
+
// 也可以在运行时通过 autoUpdater.setFeedURL 设置更新源配置
|
|
113
|
+
// autoUpdater.setFeedURL({
|
|
114
|
+
// provider: 'generic',
|
|
115
|
+
// url: 'https://exi.red',
|
|
116
|
+
// channel: 'latest',
|
|
117
|
+
// useMultipleRangeRequest: false,
|
|
118
|
+
// requestHeaders: {
|
|
119
|
+
// Authorization: `Bearer ${token}`,
|
|
120
|
+
// },
|
|
121
|
+
// })
|
|
122
|
+
publish: {
|
|
123
|
+
// 提供商
|
|
124
|
+
// - generic 普通 HTTP(S) 更新服务器
|
|
125
|
+
// - github GitHub Releases
|
|
126
|
+
// - gitlab GitLab Releases
|
|
127
|
+
// - s3 Amazon S3 对象存储
|
|
128
|
+
// - spaces DigitalOcean Spaces 对象存储
|
|
129
|
+
// - custom 自定义更新提供商
|
|
130
|
+
// - keygen Keygen 软件授权与分发服务
|
|
131
|
+
// - snapStore Snap Store
|
|
132
|
+
// - bitbucket Bitbucket Downloads
|
|
133
|
+
provider: "generic",
|
|
134
|
+
// 更新文件所在目录的基础地址
|
|
135
|
+
// 如: https://exi.red/app/updates 或 https://exi.red
|
|
136
|
+
url: "http://127.0.0.1:8080",
|
|
137
|
+
// 更新通道名称
|
|
138
|
+
channel: "latest",
|
|
139
|
+
// 差分更新下载时,是否在一个 HTTP 请求中请求多个文件区间
|
|
140
|
+
// 确认服务器支持 multipart/byteranges,使用 true
|
|
141
|
+
// 不确定是否支持,使用 false
|
|
142
|
+
// 服务器只支持普通单区间 Range,必须使用 false
|
|
143
|
+
// 服务器完全不支持 Range,无论真假,差分更新都无法正常工作
|
|
144
|
+
useMultipleRangeRequest: false
|
|
145
|
+
// electron-updater 请求更新服务时附加的 HTTP 请求头
|
|
146
|
+
// 如果需要鉴权,尽量使用 autoUpdater.requestHeaders = { Authorization: `Bearer ${token}` } 在运行时动态设置
|
|
147
|
+
// requestHeaders: undefined,
|
|
148
|
+
},
|
|
149
|
+
// URL Scheme 注册,例如 eassistant://settings
|
|
150
|
+
// [MacOS Only,在 Windows 下无效]
|
|
151
|
+
protocols: electronAppConfig.protocols?.length ? [
|
|
152
|
+
{
|
|
153
|
+
// 协议的可读名称,如 eassistant Protocol
|
|
154
|
+
name: `${electronAppConfig.productName} Protocol`,
|
|
155
|
+
// 应用支持的协议名称数组,如 [eassistant, eassistant-dev]
|
|
156
|
+
schemes: [...electronAppConfig.protocols]
|
|
157
|
+
}
|
|
158
|
+
] : void 0,
|
|
159
|
+
// 声明应用可以打开的文件扩展名
|
|
160
|
+
// nsis.perMachine: true 时生效
|
|
161
|
+
// nsis.perMachine: false 时需要通过自定义 NSIS 脚本或运行时注册实现文件关联,不能只依赖 fileAssociations
|
|
162
|
+
fileAssociations: electronAppConfig.fileAssociationExtensions?.length ? [{
|
|
163
|
+
// 文件扩展名
|
|
164
|
+
ext: [...electronAppConfig.fileAssociationExtensions],
|
|
165
|
+
// 扩展名注册名称
|
|
166
|
+
name: `${electronAppConfig.productName} File`,
|
|
167
|
+
// 扩展名注册描述
|
|
168
|
+
description: `${electronAppConfig.productName} \u5E94\u7528\u6587\u4EF6`
|
|
169
|
+
// 图标(一般不用定义)
|
|
170
|
+
// 回退机制:
|
|
171
|
+
// 1. 本属性显示配置
|
|
172
|
+
// 2. 查找首个扩展名图标,如 ext: ['ea', 'eassistant'],自动查找 build/ea.ico
|
|
173
|
+
// 3. 使用当前应用程序的 EXE 图标,eAssistant.exe,0
|
|
174
|
+
// 4. win.icon 的值
|
|
175
|
+
// 5. build/icon.ico
|
|
176
|
+
// 6. 使用 Electron 默认图标
|
|
177
|
+
// icon: undefined,
|
|
178
|
+
}] : void 0,
|
|
179
|
+
// Windows 打包选项
|
|
180
|
+
win: {
|
|
181
|
+
// 产物目标 nsis|nsis-web|portable|appx|msi|msi-wrapped|squirrel|7z/zip/tar.*|dir
|
|
182
|
+
target: [
|
|
183
|
+
{
|
|
184
|
+
// 产物目标
|
|
185
|
+
target: "nsis",
|
|
186
|
+
// 架构
|
|
187
|
+
arch: ["x64"]
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
// 默认应用图标
|
|
191
|
+
icon: "build/icons/focus.ico",
|
|
192
|
+
// 控制应用每次启动需要的 Windows 权限
|
|
193
|
+
// - asInvoker 使用当前用户权限,默认且推荐
|
|
194
|
+
// - highestAvailable 尝试使用用户可获得的最高权限
|
|
195
|
+
// - requireAdministrator 每次启动要求管理员权限并显示 UAC
|
|
196
|
+
requestedExecutionLevel: "asInvoker",
|
|
197
|
+
// 应用安装后的主程序文件名,不包含 .exe 后缀名
|
|
198
|
+
executableName: electronAppConfig.productName
|
|
199
|
+
// 是否使用 rcedit 修改并签名 EXE,默认 true
|
|
200
|
+
// signAndEditExecutable: undefined,
|
|
201
|
+
// 使用传统 Windows signtool.exe 进行代码签名
|
|
202
|
+
// signtoolOptions: undefined,
|
|
203
|
+
},
|
|
204
|
+
// NSIS 打包方式选项
|
|
205
|
+
nsis: {
|
|
206
|
+
// 设置所有快捷方式的显示名称,默认使用应用名称
|
|
207
|
+
shortcutName: electronAppConfig.productName,
|
|
208
|
+
// true 一键安装;false 显示向导页面
|
|
209
|
+
oneClick: false,
|
|
210
|
+
// 是否安装给所有用户
|
|
211
|
+
perMachine: true,
|
|
212
|
+
// 安装模式页面是否默认选“所有用户”
|
|
213
|
+
selectPerMachineByDefault: true,
|
|
214
|
+
// 向导安装时允许请求管理员权限
|
|
215
|
+
allowElevation: true,
|
|
216
|
+
// 是否允许选择安装目录
|
|
217
|
+
allowToChangeInstallationDirectory: true,
|
|
218
|
+
// 安装器包含的语言,如 ['zh_CN', 'en_US']
|
|
219
|
+
installerLanguages: ["zh_CN", "en_US"],
|
|
220
|
+
// 是否构建多语言安装器(要支持中文,必须 true)
|
|
221
|
+
multiLanguageInstaller: true,
|
|
222
|
+
// 打包提权辅助程序,electron-updater 可能需要
|
|
223
|
+
packElevateHelper: true,
|
|
224
|
+
// 多架构 target 是否合并为一个安装器
|
|
225
|
+
buildUniversalInstaller: true,
|
|
226
|
+
// 是否把 NSIS 编译警告当成构建错误,默认 true
|
|
227
|
+
warningsAsErrors: true,
|
|
228
|
+
// 安装完成后是否允许启动应用,默认 true
|
|
229
|
+
// 设置为 false 后不会自动启动,并移除对应选项
|
|
230
|
+
runAfterFinish: true,
|
|
231
|
+
// 是否创建桌面快捷方式,默认 true
|
|
232
|
+
// - true 首次安装时创建;用户删除后,升级通常尊重用户选择
|
|
233
|
+
// - false 不创建
|
|
234
|
+
// - 'always' 每次安装或升级都重新创建,即使用户曾手动删除
|
|
235
|
+
createDesktopShortcut: "always",
|
|
236
|
+
// 是否创建开始菜单快捷方式,默认 true
|
|
237
|
+
createStartMenuShortcut: true,
|
|
238
|
+
// 是否在开始菜单和安装目录中增加分类子目录,默认 false
|
|
239
|
+
// 也可以指定名称 'Exi'
|
|
240
|
+
menuCategory: false,
|
|
241
|
+
// 是否生成 Unicode NSIS 安装器,默认 true
|
|
242
|
+
// 开启后支持:中文产品名称、中文安装路径、中文用户名、多语言安装界面、非 ASCII 文件名
|
|
243
|
+
unicode: true,
|
|
244
|
+
// 卸载时跳过欢迎页面
|
|
245
|
+
// removeDefaultUninstallWelcomePage: undefined,
|
|
246
|
+
// 是否删除用户数据;类型说明限定一键安装,默认 false
|
|
247
|
+
// 通常不要启用 deleteAppDataOnUninstall,否则可能删除用户配置和业务数据
|
|
248
|
+
// deleteAppDataOnUninstall: undefined,
|
|
249
|
+
// 启动安装器时让用户选择语言
|
|
250
|
+
// displayLanguageSelector: undefined,
|
|
251
|
+
// 默认 LCID,1033 是英文美国,跟随 unicode
|
|
252
|
+
// language: undefined,
|
|
253
|
+
// 指定 NSIS 安装器识别应用身份的 GUID
|
|
254
|
+
// Windows 用它判断:当前安装包是否是同一个应用、新版本是否升级旧版本、对应哪个卸载项、是否需要卸载旧版本
|
|
255
|
+
// 默认情况下,electron-builder 会根据 appId 稳定生成 GUID
|
|
256
|
+
// 只要 appId 不变,生成的 GUID 就不变,因此通常不要手动配置
|
|
257
|
+
// guid: undefined,
|
|
258
|
+
// NSIS 安装包文件名模板
|
|
259
|
+
// artifactName: undefined,
|
|
260
|
+
// 全部范围 安装器 .exe 图标
|
|
261
|
+
// installerIcon: undefined,
|
|
262
|
+
// 全部范围 卸载程序图标
|
|
263
|
+
uninstallerIcon: "build/icons/uninstall.ico"
|
|
264
|
+
// 安装向导 页面顶部横幅 BMP
|
|
265
|
+
// installerHeader: undefined,
|
|
266
|
+
// 一键安装 进度条上方图标
|
|
267
|
+
// installerHeaderIcon: undefined,
|
|
268
|
+
// 安装向导 安装欢迎/完成页左侧图片,建议 164×314
|
|
269
|
+
// installerSidebar: undefined,
|
|
270
|
+
// 卸载向导 卸载页左侧图片
|
|
271
|
+
// uninstallerSidebar: undefined,
|
|
272
|
+
// Windows“已安装的应用”中显示的名称
|
|
273
|
+
// uninstallDisplayName: undefined,
|
|
274
|
+
// 帮助链接
|
|
275
|
+
// uninstallUrlHelp: undefined,
|
|
276
|
+
// 产品信息链接
|
|
277
|
+
// uninstallUrlInfoAbout: undefined,
|
|
278
|
+
// 更新信息链接
|
|
279
|
+
// uninstallUrlUpdateInfo: undefined,
|
|
280
|
+
// README 链接
|
|
281
|
+
// uninstallUrlReadme: undefined,
|
|
282
|
+
// 注入自定义 .nsh 宏,保留 electron-builder 默认安装流程
|
|
283
|
+
// include: undefined,
|
|
284
|
+
// 使用完整自定义 .nsi 替换默认安装脚本
|
|
285
|
+
// script: undefined,
|
|
286
|
+
// 安装时展示的 EULA 文件
|
|
287
|
+
// license: undefined,
|
|
288
|
+
},
|
|
289
|
+
// 压缩等级:store、normal、maximum
|
|
290
|
+
// 正式构建用 normal 即可;maximum 构建更慢但体积改善通常很小
|
|
291
|
+
compression: "normal",
|
|
292
|
+
// 保留的 Electron locale 语言包
|
|
293
|
+
// 可设置 ['zh-CN', 'en-US'] 减少体积;需要其他语言时不要限制
|
|
294
|
+
electronLanguages: ["zh-CN", "en-US"],
|
|
295
|
+
// 从打包后的 package.json 删除 scripts
|
|
296
|
+
removePackageScripts: true,
|
|
297
|
+
// 从打包后的 package.json 删除 keywords
|
|
298
|
+
removePackageKeywords: true
|
|
299
|
+
// 是否从预发布版本号推断频道,保持默认 true
|
|
300
|
+
// detectUpdateChannel: undefined,
|
|
301
|
+
// 是否同时生成低级频道的更新文件,只用 latest 时保持 false
|
|
302
|
+
// generateUpdatesFilesForAllChannels: undefined,
|
|
303
|
+
// 用于继承其他 electron-builder 配置
|
|
304
|
+
// 适合多个应用共享基础配置,或者拆分平台配置
|
|
305
|
+
// 如 './build/electron-builder.base.ts'
|
|
306
|
+
// extends: undefined,
|
|
307
|
+
// 无法完成代码签名时是否直接让构建失败
|
|
308
|
+
// 正式 CI 配好证书后建议 true
|
|
309
|
+
// forceCodeSigning: undefined,
|
|
310
|
+
// 代码签名证书地址,可以是文件、URL或 Base64
|
|
311
|
+
// 不建议写在仓库,使用 CSC_LINK 环境变量
|
|
312
|
+
// cscLink: undefined,
|
|
313
|
+
// 代码签名证书密码
|
|
314
|
+
// 使用 CSC_KEY_PASSWORD 环境变量,不能提交到 Git
|
|
315
|
+
// cscKeyPassword: undefined,
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
var defineElectronBuilderConfig = (options, override) => {
|
|
319
|
+
return ObjectUtil.merge(defaultConfig(options), override ?? {}, {
|
|
320
|
+
array: "override",
|
|
321
|
+
object: "recursive",
|
|
322
|
+
undefined: "skip",
|
|
323
|
+
null: "override"
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
function parsePackageJson(rootDir) {
|
|
327
|
+
const file = path.resolve(rootDir, "package.json");
|
|
328
|
+
const json = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
329
|
+
if (!json.version) {
|
|
330
|
+
throw new Error(`package.json \u672A\u914D\u7F6E version \u5B57\u6BB5`);
|
|
331
|
+
}
|
|
332
|
+
if (json.$releaseNotes && json.version !== json.$releaseNotes?.version) {
|
|
333
|
+
throw new Error(`package.json \u4E2D\u7684 version \u4E0E $releaseNotes.version \u4E0D\u4E00\u81F4`);
|
|
334
|
+
}
|
|
335
|
+
return json;
|
|
336
|
+
}
|
|
337
|
+
function serializeReleaseNotes(notes) {
|
|
338
|
+
return notes ? JSON.stringify(notes) : void 0;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// node_modules/@vitejs/plugin-vue/dist/index.mjs
|
|
342
|
+
import { createRequire } from "node:module";
|
|
343
|
+
import fs2 from "node:fs";
|
|
344
|
+
import { createFilter, formatPostcssSourceMap, isCSSRequest, normalizePath, transformWithEsbuild } from "vite";
|
|
345
|
+
import { computed, shallowRef } from "vue";
|
|
346
|
+
|
|
347
|
+
// node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js
|
|
348
|
+
function exactRegex(str, flags) {
|
|
349
|
+
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
350
|
+
}
|
|
351
|
+
var escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
|
352
|
+
function escapeRegex(str) {
|
|
353
|
+
return str.replace(escapeRegexRE, "\\$&");
|
|
354
|
+
}
|
|
355
|
+
function makeIdFiltersToMatchWithQuery(input) {
|
|
356
|
+
if (!Array.isArray(input)) {
|
|
357
|
+
return makeIdFilterToMatchWithQuery(
|
|
358
|
+
// Array.isArray cannot narrow the type
|
|
359
|
+
// https://github.com/microsoft/TypeScript/issues/17002
|
|
360
|
+
input
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
return input.map((i) => makeIdFilterToMatchWithQuery(i));
|
|
364
|
+
}
|
|
365
|
+
function makeIdFilterToMatchWithQuery(input) {
|
|
366
|
+
if (typeof input === "string") {
|
|
367
|
+
return `${input}{?*,}`;
|
|
368
|
+
}
|
|
369
|
+
return makeRegexIdFilterToMatchWithQuery(input);
|
|
370
|
+
}
|
|
371
|
+
function makeRegexIdFilterToMatchWithQuery(input) {
|
|
372
|
+
return new RegExp(
|
|
373
|
+
// replace `$` with `(?:\?.*)?$` (ignore `\$`)
|
|
374
|
+
input.source.replace(/(?<!\\)\$/g, "(?:\\?.*)?$"),
|
|
375
|
+
input.flags
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// node_modules/@vitejs/plugin-vue/dist/index.mjs
|
|
380
|
+
import path2 from "node:path";
|
|
381
|
+
import crypto from "node:crypto";
|
|
382
|
+
import { isatty } from "node:tty";
|
|
383
|
+
import { formatWithOptions, inspect } from "node:util";
|
|
384
|
+
var version = "6.0.6";
|
|
385
|
+
function resolveCompiler(root) {
|
|
386
|
+
const compiler = tryResolveCompiler(root) || tryResolveCompiler();
|
|
387
|
+
if (!compiler) throw new Error("Failed to resolve vue/compiler-sfc.\n@vitejs/plugin-vue requires vue (>=3.2.25) to be present in the dependency tree.");
|
|
388
|
+
return compiler;
|
|
389
|
+
}
|
|
390
|
+
function tryResolveCompiler(root) {
|
|
391
|
+
const vueMeta = tryRequire("vue/package.json", root);
|
|
392
|
+
if (vueMeta && vueMeta.version.split(".")[0] >= 3) return tryRequire("vue/compiler-sfc", root);
|
|
393
|
+
}
|
|
394
|
+
var _require = createRequire(import.meta.url);
|
|
395
|
+
function tryRequire(id, from) {
|
|
396
|
+
try {
|
|
397
|
+
return from ? _require(_require.resolve(id, { paths: [from] })) : _require(id);
|
|
398
|
+
} catch (e) {
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function parseVueRequest(id) {
|
|
402
|
+
const [filename, rawQuery] = id.split(`?`, 2);
|
|
403
|
+
const query = Object.fromEntries(new URLSearchParams(rawQuery));
|
|
404
|
+
if (query.vue != null) query.vue = true;
|
|
405
|
+
if (query.index != null) query.index = Number(query.index);
|
|
406
|
+
if (query.raw != null) query.raw = true;
|
|
407
|
+
if (query.url != null) query.url = true;
|
|
408
|
+
if (query.scoped != null) query.scoped = true;
|
|
409
|
+
return {
|
|
410
|
+
filename,
|
|
411
|
+
query
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
var cache = /* @__PURE__ */ new Map();
|
|
415
|
+
var hmrCache = /* @__PURE__ */ new Map();
|
|
416
|
+
var prevCache = /* @__PURE__ */ new Map();
|
|
417
|
+
function createDescriptor(filename, source, { root, isProduction, sourceMap, compiler, template, features }, hmr = false) {
|
|
418
|
+
const { descriptor, errors } = compiler.parse(source, {
|
|
419
|
+
filename,
|
|
420
|
+
sourceMap,
|
|
421
|
+
templateParseOptions: template?.compilerOptions
|
|
422
|
+
});
|
|
423
|
+
const normalizedPath = normalizePath(path2.relative(root, filename));
|
|
424
|
+
const componentIdGenerator = features?.componentIdGenerator;
|
|
425
|
+
if (componentIdGenerator === "filepath") descriptor.id = getHash(normalizedPath);
|
|
426
|
+
else if (componentIdGenerator === "filepath-source") descriptor.id = getHash(normalizedPath + source);
|
|
427
|
+
else if (typeof componentIdGenerator === "function") descriptor.id = componentIdGenerator(normalizedPath, source, isProduction, getHash);
|
|
428
|
+
else descriptor.id = getHash(normalizedPath + (isProduction ? source : ""));
|
|
429
|
+
(hmr ? hmrCache : cache).set(filename, descriptor);
|
|
430
|
+
return {
|
|
431
|
+
descriptor,
|
|
432
|
+
errors
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
function getPrevDescriptor(filename) {
|
|
436
|
+
return prevCache.get(filename);
|
|
437
|
+
}
|
|
438
|
+
function invalidateDescriptor(filename, hmr = false) {
|
|
439
|
+
const _cache = hmr ? hmrCache : cache;
|
|
440
|
+
const prev = _cache.get(filename);
|
|
441
|
+
_cache.delete(filename);
|
|
442
|
+
if (prev) prevCache.set(filename, prev);
|
|
443
|
+
}
|
|
444
|
+
function getDescriptor(filename, options, createIfNotFound = true, hmr = false, code) {
|
|
445
|
+
const _cache = hmr ? hmrCache : cache;
|
|
446
|
+
if (_cache.has(filename)) return _cache.get(filename);
|
|
447
|
+
if (createIfNotFound) {
|
|
448
|
+
const { descriptor, errors } = createDescriptor(filename, code ?? fs2.readFileSync(filename, "utf-8"), options, hmr);
|
|
449
|
+
if (errors.length && !hmr) throw errors[0];
|
|
450
|
+
return descriptor;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function getSrcDescriptor(filename, query) {
|
|
454
|
+
if (query.scoped) return cache.get(`${filename}?src=${query.src}`);
|
|
455
|
+
return cache.get(filename);
|
|
456
|
+
}
|
|
457
|
+
function getTempSrcDescriptor(filename, query) {
|
|
458
|
+
return {
|
|
459
|
+
filename,
|
|
460
|
+
id: query.id || "",
|
|
461
|
+
styles: [{
|
|
462
|
+
scoped: query.scoped,
|
|
463
|
+
loc: { start: {
|
|
464
|
+
line: 0,
|
|
465
|
+
column: 0
|
|
466
|
+
} }
|
|
467
|
+
}],
|
|
468
|
+
isTemp: true
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
function setSrcDescriptor(filename, entry, scoped) {
|
|
472
|
+
if (scoped) {
|
|
473
|
+
cache.set(`${filename}?src=${entry.id}`, entry);
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
cache.set(filename, entry);
|
|
477
|
+
}
|
|
478
|
+
function getHash(text) {
|
|
479
|
+
return crypto.hash("sha256", text, "hex").substring(0, 8);
|
|
480
|
+
}
|
|
481
|
+
function slash(path4) {
|
|
482
|
+
if (path4.startsWith("\\\\?\\")) return path4;
|
|
483
|
+
return path4.replace(/\\/g, "/");
|
|
484
|
+
}
|
|
485
|
+
function createRollupError(id, error) {
|
|
486
|
+
const { message, name, stack } = error;
|
|
487
|
+
const rollupError = {
|
|
488
|
+
id,
|
|
489
|
+
plugin: "vue",
|
|
490
|
+
message,
|
|
491
|
+
name,
|
|
492
|
+
stack
|
|
493
|
+
};
|
|
494
|
+
if ("code" in error && error.loc) rollupError.loc = {
|
|
495
|
+
file: id,
|
|
496
|
+
line: error.loc.start.line,
|
|
497
|
+
column: error.loc.start.column
|
|
498
|
+
};
|
|
499
|
+
return rollupError;
|
|
500
|
+
}
|
|
501
|
+
async function transformTemplateAsModule(code, filename, descriptor, options, pluginContext, ssr, customElement) {
|
|
502
|
+
const result = compile(code, filename, descriptor, options, pluginContext, ssr, customElement);
|
|
503
|
+
let returnCode = result.code;
|
|
504
|
+
returnCode += `
|
|
505
|
+
export const multiRoot = ${JSON.stringify(result.multiRoot)}`;
|
|
506
|
+
if (options.devServer && options.devServer.config.server.hmr !== false && !ssr && !options.isProduction) returnCode += `
|
|
507
|
+
import.meta.hot.accept(({ render }) => {
|
|
508
|
+
__VUE_HMR_RUNTIME__.rerender(${JSON.stringify(descriptor.id)}, render)
|
|
509
|
+
})`;
|
|
510
|
+
return {
|
|
511
|
+
code: returnCode,
|
|
512
|
+
map: result.map
|
|
513
|
+
};
|
|
514
|
+
}
|
|
515
|
+
function transformTemplateInMain(code, descriptor, options, pluginContext, ssr, customElement) {
|
|
516
|
+
const result = compile(code, descriptor.filename, descriptor, options, pluginContext, ssr, customElement);
|
|
517
|
+
return {
|
|
518
|
+
...result,
|
|
519
|
+
code: result.code.replace(/\nexport (function|const) (render|ssrRender)/, "\n$1 _sfc_$2")
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
function compile(code, filename, descriptor, options, pluginContext, ssr, customElement) {
|
|
523
|
+
resolveScript(descriptor, options, ssr, customElement);
|
|
524
|
+
const result = options.compiler.compileTemplate({
|
|
525
|
+
...resolveTemplateCompilerOptions(descriptor, options, filename, ssr),
|
|
526
|
+
source: code
|
|
527
|
+
});
|
|
528
|
+
if (result.errors.length) result.errors.forEach((error) => pluginContext.error(typeof error === "string" ? {
|
|
529
|
+
id: filename,
|
|
530
|
+
message: error
|
|
531
|
+
} : createRollupError(filename, error)));
|
|
532
|
+
if (result.tips.length) result.tips.forEach((tip) => pluginContext.warn({
|
|
533
|
+
id: filename,
|
|
534
|
+
message: tip
|
|
535
|
+
}));
|
|
536
|
+
return result;
|
|
537
|
+
}
|
|
538
|
+
function resolveTemplateCompilerOptions(descriptor, options, filename, ssr) {
|
|
539
|
+
const block = descriptor.template;
|
|
540
|
+
if (!block) return;
|
|
541
|
+
const resolvedScript = getResolvedScript(descriptor, ssr);
|
|
542
|
+
const hasScoped = descriptor.styles.some((s) => s.scoped);
|
|
543
|
+
const { id, cssVars } = descriptor;
|
|
544
|
+
let transformAssetUrls = options.template?.transformAssetUrls;
|
|
545
|
+
let assetUrlOptions;
|
|
546
|
+
if (transformAssetUrls === false) {
|
|
547
|
+
} else if (options.devServer) {
|
|
548
|
+
if (filename.startsWith(options.root)) {
|
|
549
|
+
const devBase = options.devServer.config.base;
|
|
550
|
+
assetUrlOptions = {
|
|
551
|
+
base: (options.devServer.config.server?.origin ?? "") + devBase + slash(path2.relative(options.root, path2.dirname(filename))),
|
|
552
|
+
includeAbsolute: !!devBase
|
|
553
|
+
};
|
|
554
|
+
}
|
|
555
|
+
} else assetUrlOptions = { includeAbsolute: true };
|
|
556
|
+
if (transformAssetUrls && typeof transformAssetUrls === "object") if (Object.values(transformAssetUrls).some((val) => Array.isArray(val))) transformAssetUrls = {
|
|
557
|
+
...assetUrlOptions,
|
|
558
|
+
tags: transformAssetUrls
|
|
559
|
+
};
|
|
560
|
+
else transformAssetUrls = {
|
|
561
|
+
...assetUrlOptions,
|
|
562
|
+
...transformAssetUrls
|
|
563
|
+
};
|
|
564
|
+
else transformAssetUrls = assetUrlOptions;
|
|
565
|
+
let preprocessOptions = block.lang && options.template?.preprocessOptions;
|
|
566
|
+
if (block.lang === "pug") preprocessOptions = {
|
|
567
|
+
doctype: "html",
|
|
568
|
+
...preprocessOptions
|
|
569
|
+
};
|
|
570
|
+
const expressionPlugins = options.template?.compilerOptions?.expressionPlugins || [];
|
|
571
|
+
const lang = descriptor.scriptSetup?.lang || descriptor.script?.lang;
|
|
572
|
+
if (lang && /tsx?$/.test(lang) && !expressionPlugins.includes("typescript")) expressionPlugins.push("typescript");
|
|
573
|
+
return {
|
|
574
|
+
...options.template,
|
|
575
|
+
vapor: descriptor.vapor,
|
|
576
|
+
id,
|
|
577
|
+
ast: canReuseAST(options.compiler.version) ? descriptor.template?.ast : void 0,
|
|
578
|
+
filename,
|
|
579
|
+
scoped: hasScoped,
|
|
580
|
+
slotted: descriptor.slotted,
|
|
581
|
+
isProd: options.isProduction,
|
|
582
|
+
inMap: block.src ? void 0 : block.map,
|
|
583
|
+
ssr,
|
|
584
|
+
ssrCssVars: cssVars,
|
|
585
|
+
transformAssetUrls,
|
|
586
|
+
preprocessLang: block.lang === "html" ? void 0 : block.lang,
|
|
587
|
+
preprocessOptions,
|
|
588
|
+
compilerOptions: {
|
|
589
|
+
...options.template?.compilerOptions,
|
|
590
|
+
scopeId: hasScoped ? `data-v-${id}` : void 0,
|
|
591
|
+
bindingMetadata: resolvedScript ? resolvedScript.bindings : void 0,
|
|
592
|
+
expressionPlugins,
|
|
593
|
+
sourceMap: options.sourceMap
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function canReuseAST(version2) {
|
|
598
|
+
if (version2) {
|
|
599
|
+
const [_, minor, patch] = version2.split(".").map(Number);
|
|
600
|
+
if (minor >= 4 && patch >= 3) return true;
|
|
601
|
+
}
|
|
602
|
+
return false;
|
|
603
|
+
}
|
|
604
|
+
var clientCache = /* @__PURE__ */ new WeakMap();
|
|
605
|
+
var ssrCache = /* @__PURE__ */ new WeakMap();
|
|
606
|
+
var typeDepToSFCMap = /* @__PURE__ */ new Map();
|
|
607
|
+
function invalidateScript(filename) {
|
|
608
|
+
const desc = cache.get(filename);
|
|
609
|
+
if (desc) {
|
|
610
|
+
clientCache.delete(desc);
|
|
611
|
+
ssrCache.delete(desc);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
function getResolvedScript(descriptor, ssr) {
|
|
615
|
+
return (ssr ? ssrCache : clientCache).get(descriptor);
|
|
616
|
+
}
|
|
617
|
+
function setResolvedScript(descriptor, script, ssr) {
|
|
618
|
+
(ssr ? ssrCache : clientCache).set(descriptor, script);
|
|
619
|
+
}
|
|
620
|
+
function clearScriptCache() {
|
|
621
|
+
clientCache = /* @__PURE__ */ new WeakMap();
|
|
622
|
+
ssrCache = /* @__PURE__ */ new WeakMap();
|
|
623
|
+
}
|
|
624
|
+
function isUseInlineTemplate(descriptor, options) {
|
|
625
|
+
return !options.devServer && !options.devToolsEnabled && !!descriptor.scriptSetup && !descriptor.template?.src;
|
|
626
|
+
}
|
|
627
|
+
var scriptIdentifier = `_sfc_main`;
|
|
628
|
+
function resolveScript(descriptor, options, ssr, customElement) {
|
|
629
|
+
if (!descriptor.script && !descriptor.scriptSetup) return null;
|
|
630
|
+
const cached = getResolvedScript(descriptor, ssr);
|
|
631
|
+
if (cached) return cached;
|
|
632
|
+
const resolved = options.compiler.compileScript(descriptor, {
|
|
633
|
+
...options.script,
|
|
634
|
+
id: descriptor.id,
|
|
635
|
+
isProd: options.isProduction,
|
|
636
|
+
inlineTemplate: isUseInlineTemplate(descriptor, options),
|
|
637
|
+
templateOptions: resolveTemplateCompilerOptions(descriptor, options, descriptor.filename, ssr),
|
|
638
|
+
sourceMap: options.sourceMap,
|
|
639
|
+
genDefaultAs: canInlineMain(descriptor, options) ? scriptIdentifier : void 0,
|
|
640
|
+
customElement,
|
|
641
|
+
propsDestructure: options.features?.propsDestructure ?? options.script?.propsDestructure
|
|
642
|
+
});
|
|
643
|
+
if (!options.isProduction && resolved?.deps) {
|
|
644
|
+
for (const [key, sfcs] of typeDepToSFCMap) if (sfcs.has(descriptor.filename) && !resolved.deps.includes(key)) sfcs.delete(descriptor.filename);
|
|
645
|
+
for (const dep of resolved.deps) {
|
|
646
|
+
const existingSet = typeDepToSFCMap.get(dep);
|
|
647
|
+
if (!existingSet) typeDepToSFCMap.set(dep, /* @__PURE__ */ new Set([descriptor.filename]));
|
|
648
|
+
else existingSet.add(descriptor.filename);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
setResolvedScript(descriptor, resolved, ssr);
|
|
652
|
+
return resolved;
|
|
653
|
+
}
|
|
654
|
+
function canInlineMain(descriptor, options) {
|
|
655
|
+
if (descriptor.script?.src || descriptor.scriptSetup?.src) return false;
|
|
656
|
+
const lang = descriptor.script?.lang || descriptor.scriptSetup?.lang;
|
|
657
|
+
if (!lang || lang === "js") return true;
|
|
658
|
+
if (lang === "ts" && options.devServer) return true;
|
|
659
|
+
return false;
|
|
660
|
+
}
|
|
661
|
+
var comma = ",".charCodeAt(0);
|
|
662
|
+
var semicolon = ";".charCodeAt(0);
|
|
663
|
+
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
664
|
+
var intToChar = new Uint8Array(64);
|
|
665
|
+
var charToInt = new Uint8Array(128);
|
|
666
|
+
for (let i = 0; i < chars.length; i++) {
|
|
667
|
+
const c = chars.charCodeAt(i);
|
|
668
|
+
intToChar[i] = c;
|
|
669
|
+
charToInt[c] = i;
|
|
670
|
+
}
|
|
671
|
+
function decodeInteger(reader, relative) {
|
|
672
|
+
let value = 0;
|
|
673
|
+
let shift = 0;
|
|
674
|
+
let integer = 0;
|
|
675
|
+
do {
|
|
676
|
+
integer = charToInt[reader.next()];
|
|
677
|
+
value |= (integer & 31) << shift;
|
|
678
|
+
shift += 5;
|
|
679
|
+
} while (integer & 32);
|
|
680
|
+
const shouldNegate = value & 1;
|
|
681
|
+
value >>>= 1;
|
|
682
|
+
if (shouldNegate) value = -2147483648 | -value;
|
|
683
|
+
return relative + value;
|
|
684
|
+
}
|
|
685
|
+
function encodeInteger(builder, num, relative) {
|
|
686
|
+
let delta = num - relative;
|
|
687
|
+
delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
|
|
688
|
+
do {
|
|
689
|
+
let clamped = delta & 31;
|
|
690
|
+
delta >>>= 5;
|
|
691
|
+
if (delta > 0) clamped |= 32;
|
|
692
|
+
builder.write(intToChar[clamped]);
|
|
693
|
+
} while (delta > 0);
|
|
694
|
+
return num;
|
|
695
|
+
}
|
|
696
|
+
function hasMoreVlq(reader, max) {
|
|
697
|
+
if (reader.pos >= max) return false;
|
|
698
|
+
return reader.peek() !== comma;
|
|
699
|
+
}
|
|
700
|
+
var bufLength = 1024 * 16;
|
|
701
|
+
var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { decode(buf) {
|
|
702
|
+
return Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength).toString();
|
|
703
|
+
} } : { decode(buf) {
|
|
704
|
+
let out = "";
|
|
705
|
+
for (let i = 0; i < buf.length; i++) out += String.fromCharCode(buf[i]);
|
|
706
|
+
return out;
|
|
707
|
+
} };
|
|
708
|
+
var StringWriter = class {
|
|
709
|
+
constructor() {
|
|
710
|
+
this.pos = 0;
|
|
711
|
+
this.out = "";
|
|
712
|
+
this.buffer = new Uint8Array(bufLength);
|
|
713
|
+
}
|
|
714
|
+
write(v) {
|
|
715
|
+
const { buffer } = this;
|
|
716
|
+
buffer[this.pos++] = v;
|
|
717
|
+
if (this.pos === bufLength) {
|
|
718
|
+
this.out += td.decode(buffer);
|
|
719
|
+
this.pos = 0;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
flush() {
|
|
723
|
+
const { buffer, out, pos } = this;
|
|
724
|
+
return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
|
|
725
|
+
}
|
|
726
|
+
};
|
|
727
|
+
var StringReader = class {
|
|
728
|
+
constructor(buffer) {
|
|
729
|
+
this.pos = 0;
|
|
730
|
+
this.buffer = buffer;
|
|
731
|
+
}
|
|
732
|
+
next() {
|
|
733
|
+
return this.buffer.charCodeAt(this.pos++);
|
|
734
|
+
}
|
|
735
|
+
peek() {
|
|
736
|
+
return this.buffer.charCodeAt(this.pos);
|
|
737
|
+
}
|
|
738
|
+
indexOf(char) {
|
|
739
|
+
const { buffer, pos } = this;
|
|
740
|
+
const idx = buffer.indexOf(char, pos);
|
|
741
|
+
return idx === -1 ? buffer.length : idx;
|
|
742
|
+
}
|
|
743
|
+
};
|
|
744
|
+
function decode(mappings) {
|
|
745
|
+
const { length } = mappings;
|
|
746
|
+
const reader = new StringReader(mappings);
|
|
747
|
+
const decoded = [];
|
|
748
|
+
let genColumn = 0;
|
|
749
|
+
let sourcesIndex = 0;
|
|
750
|
+
let sourceLine = 0;
|
|
751
|
+
let sourceColumn = 0;
|
|
752
|
+
let namesIndex = 0;
|
|
753
|
+
do {
|
|
754
|
+
const semi = reader.indexOf(";");
|
|
755
|
+
const line = [];
|
|
756
|
+
let sorted = true;
|
|
757
|
+
let lastCol = 0;
|
|
758
|
+
genColumn = 0;
|
|
759
|
+
while (reader.pos < semi) {
|
|
760
|
+
let seg;
|
|
761
|
+
genColumn = decodeInteger(reader, genColumn);
|
|
762
|
+
if (genColumn < lastCol) sorted = false;
|
|
763
|
+
lastCol = genColumn;
|
|
764
|
+
if (hasMoreVlq(reader, semi)) {
|
|
765
|
+
sourcesIndex = decodeInteger(reader, sourcesIndex);
|
|
766
|
+
sourceLine = decodeInteger(reader, sourceLine);
|
|
767
|
+
sourceColumn = decodeInteger(reader, sourceColumn);
|
|
768
|
+
if (hasMoreVlq(reader, semi)) {
|
|
769
|
+
namesIndex = decodeInteger(reader, namesIndex);
|
|
770
|
+
seg = [
|
|
771
|
+
genColumn,
|
|
772
|
+
sourcesIndex,
|
|
773
|
+
sourceLine,
|
|
774
|
+
sourceColumn,
|
|
775
|
+
namesIndex
|
|
776
|
+
];
|
|
777
|
+
} else seg = [
|
|
778
|
+
genColumn,
|
|
779
|
+
sourcesIndex,
|
|
780
|
+
sourceLine,
|
|
781
|
+
sourceColumn
|
|
782
|
+
];
|
|
783
|
+
} else seg = [genColumn];
|
|
784
|
+
line.push(seg);
|
|
785
|
+
reader.pos++;
|
|
786
|
+
}
|
|
787
|
+
if (!sorted) sort(line);
|
|
788
|
+
decoded.push(line);
|
|
789
|
+
reader.pos = semi + 1;
|
|
790
|
+
} while (reader.pos <= length);
|
|
791
|
+
return decoded;
|
|
792
|
+
}
|
|
793
|
+
function sort(line) {
|
|
794
|
+
line.sort(sortComparator$1);
|
|
795
|
+
}
|
|
796
|
+
function sortComparator$1(a, b) {
|
|
797
|
+
return a[0] - b[0];
|
|
798
|
+
}
|
|
799
|
+
function encode(decoded) {
|
|
800
|
+
const writer = new StringWriter();
|
|
801
|
+
let sourcesIndex = 0;
|
|
802
|
+
let sourceLine = 0;
|
|
803
|
+
let sourceColumn = 0;
|
|
804
|
+
let namesIndex = 0;
|
|
805
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
806
|
+
const line = decoded[i];
|
|
807
|
+
if (i > 0) writer.write(semicolon);
|
|
808
|
+
if (line.length === 0) continue;
|
|
809
|
+
let genColumn = 0;
|
|
810
|
+
for (let j = 0; j < line.length; j++) {
|
|
811
|
+
const segment = line[j];
|
|
812
|
+
if (j > 0) writer.write(comma);
|
|
813
|
+
genColumn = encodeInteger(writer, segment[0], genColumn);
|
|
814
|
+
if (segment.length === 1) continue;
|
|
815
|
+
sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
|
|
816
|
+
sourceLine = encodeInteger(writer, segment[2], sourceLine);
|
|
817
|
+
sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
|
|
818
|
+
if (segment.length === 4) continue;
|
|
819
|
+
namesIndex = encodeInteger(writer, segment[4], namesIndex);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
return writer.flush();
|
|
823
|
+
}
|
|
824
|
+
var schemeRegex = /^[\w+.-]+:\/\//;
|
|
825
|
+
var urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
|
|
826
|
+
var fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
|
|
827
|
+
function isAbsoluteUrl(input) {
|
|
828
|
+
return schemeRegex.test(input);
|
|
829
|
+
}
|
|
830
|
+
function isSchemeRelativeUrl(input) {
|
|
831
|
+
return input.startsWith("//");
|
|
832
|
+
}
|
|
833
|
+
function isAbsolutePath(input) {
|
|
834
|
+
return input.startsWith("/");
|
|
835
|
+
}
|
|
836
|
+
function isFileUrl(input) {
|
|
837
|
+
return input.startsWith("file:");
|
|
838
|
+
}
|
|
839
|
+
function isRelative(input) {
|
|
840
|
+
return /^[.?#]/.test(input);
|
|
841
|
+
}
|
|
842
|
+
function parseAbsoluteUrl(input) {
|
|
843
|
+
const match = urlRegex.exec(input);
|
|
844
|
+
return makeUrl(match[1], match[2] || "", match[3], match[4] || "", match[5] || "/", match[6] || "", match[7] || "");
|
|
845
|
+
}
|
|
846
|
+
function parseFileUrl(input) {
|
|
847
|
+
const match = fileRegex.exec(input);
|
|
848
|
+
const path4 = match[2];
|
|
849
|
+
return makeUrl("file:", "", match[1] || "", "", isAbsolutePath(path4) ? path4 : "/" + path4, match[3] || "", match[4] || "");
|
|
850
|
+
}
|
|
851
|
+
function makeUrl(scheme, user, host, port, path4, query, hash) {
|
|
852
|
+
return {
|
|
853
|
+
scheme,
|
|
854
|
+
user,
|
|
855
|
+
host,
|
|
856
|
+
port,
|
|
857
|
+
path: path4,
|
|
858
|
+
query,
|
|
859
|
+
hash,
|
|
860
|
+
type: 7
|
|
861
|
+
};
|
|
862
|
+
}
|
|
863
|
+
function parseUrl(input) {
|
|
864
|
+
if (isSchemeRelativeUrl(input)) {
|
|
865
|
+
const url2 = parseAbsoluteUrl("http:" + input);
|
|
866
|
+
url2.scheme = "";
|
|
867
|
+
url2.type = 6;
|
|
868
|
+
return url2;
|
|
869
|
+
}
|
|
870
|
+
if (isAbsolutePath(input)) {
|
|
871
|
+
const url2 = parseAbsoluteUrl("http://foo.com" + input);
|
|
872
|
+
url2.scheme = "";
|
|
873
|
+
url2.host = "";
|
|
874
|
+
url2.type = 5;
|
|
875
|
+
return url2;
|
|
876
|
+
}
|
|
877
|
+
if (isFileUrl(input)) return parseFileUrl(input);
|
|
878
|
+
if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
|
|
879
|
+
const url = parseAbsoluteUrl("http://foo.com/" + input);
|
|
880
|
+
url.scheme = "";
|
|
881
|
+
url.host = "";
|
|
882
|
+
url.type = input ? input.startsWith("?") ? 3 : input.startsWith("#") ? 2 : 4 : 1;
|
|
883
|
+
return url;
|
|
884
|
+
}
|
|
885
|
+
function stripPathFilename(path4) {
|
|
886
|
+
if (path4.endsWith("/..")) return path4;
|
|
887
|
+
const index = path4.lastIndexOf("/");
|
|
888
|
+
return path4.slice(0, index + 1);
|
|
889
|
+
}
|
|
890
|
+
function mergePaths(url, base) {
|
|
891
|
+
normalizePath$1(base, base.type);
|
|
892
|
+
if (url.path === "/") url.path = base.path;
|
|
893
|
+
else url.path = stripPathFilename(base.path) + url.path;
|
|
894
|
+
}
|
|
895
|
+
function normalizePath$1(url, type) {
|
|
896
|
+
const rel = type <= 4;
|
|
897
|
+
const pieces = url.path.split("/");
|
|
898
|
+
let pointer = 1;
|
|
899
|
+
let positive = 0;
|
|
900
|
+
let addTrailingSlash = false;
|
|
901
|
+
for (let i = 1; i < pieces.length; i++) {
|
|
902
|
+
const piece = pieces[i];
|
|
903
|
+
if (!piece) {
|
|
904
|
+
addTrailingSlash = true;
|
|
905
|
+
continue;
|
|
906
|
+
}
|
|
907
|
+
addTrailingSlash = false;
|
|
908
|
+
if (piece === ".") continue;
|
|
909
|
+
if (piece === "..") {
|
|
910
|
+
if (positive) {
|
|
911
|
+
addTrailingSlash = true;
|
|
912
|
+
positive--;
|
|
913
|
+
pointer--;
|
|
914
|
+
} else if (rel) pieces[pointer++] = piece;
|
|
915
|
+
continue;
|
|
916
|
+
}
|
|
917
|
+
pieces[pointer++] = piece;
|
|
918
|
+
positive++;
|
|
919
|
+
}
|
|
920
|
+
let path4 = "";
|
|
921
|
+
for (let i = 1; i < pointer; i++) path4 += "/" + pieces[i];
|
|
922
|
+
if (!path4 || addTrailingSlash && !path4.endsWith("/..")) path4 += "/";
|
|
923
|
+
url.path = path4;
|
|
924
|
+
}
|
|
925
|
+
function resolve(input, base) {
|
|
926
|
+
if (!input && !base) return "";
|
|
927
|
+
const url = parseUrl(input);
|
|
928
|
+
let inputType = url.type;
|
|
929
|
+
if (base && inputType !== 7) {
|
|
930
|
+
const baseUrl = parseUrl(base);
|
|
931
|
+
const baseType = baseUrl.type;
|
|
932
|
+
switch (inputType) {
|
|
933
|
+
case 1:
|
|
934
|
+
url.hash = baseUrl.hash;
|
|
935
|
+
case 2:
|
|
936
|
+
url.query = baseUrl.query;
|
|
937
|
+
case 3:
|
|
938
|
+
case 4:
|
|
939
|
+
mergePaths(url, baseUrl);
|
|
940
|
+
case 5:
|
|
941
|
+
url.user = baseUrl.user;
|
|
942
|
+
url.host = baseUrl.host;
|
|
943
|
+
url.port = baseUrl.port;
|
|
944
|
+
case 6:
|
|
945
|
+
url.scheme = baseUrl.scheme;
|
|
946
|
+
}
|
|
947
|
+
if (baseType > inputType) inputType = baseType;
|
|
948
|
+
}
|
|
949
|
+
normalizePath$1(url, inputType);
|
|
950
|
+
const queryHash = url.query + url.hash;
|
|
951
|
+
switch (inputType) {
|
|
952
|
+
case 2:
|
|
953
|
+
case 3:
|
|
954
|
+
return queryHash;
|
|
955
|
+
case 4: {
|
|
956
|
+
const path4 = url.path.slice(1);
|
|
957
|
+
if (!path4) return queryHash || ".";
|
|
958
|
+
if (isRelative(base || input) && !isRelative(path4)) return "./" + path4 + queryHash;
|
|
959
|
+
return path4 + queryHash;
|
|
960
|
+
}
|
|
961
|
+
case 5:
|
|
962
|
+
return url.path + queryHash;
|
|
963
|
+
default:
|
|
964
|
+
return url.scheme + "//" + url.user + url.host + url.port + url.path + queryHash;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
function stripFilename(path4) {
|
|
968
|
+
if (!path4) return "";
|
|
969
|
+
const index = path4.lastIndexOf("/");
|
|
970
|
+
return path4.slice(0, index + 1);
|
|
971
|
+
}
|
|
972
|
+
function resolver(mapUrl, sourceRoot) {
|
|
973
|
+
const from = stripFilename(mapUrl);
|
|
974
|
+
const prefix = sourceRoot ? sourceRoot + "/" : "";
|
|
975
|
+
return (source) => resolve(prefix + (source || ""), from);
|
|
976
|
+
}
|
|
977
|
+
var COLUMN$1 = 0;
|
|
978
|
+
function maybeSort(mappings, owned) {
|
|
979
|
+
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
|
|
980
|
+
if (unsortedIndex === mappings.length) return mappings;
|
|
981
|
+
if (!owned) mappings = mappings.slice();
|
|
982
|
+
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) mappings[i] = sortSegments(mappings[i], owned);
|
|
983
|
+
return mappings;
|
|
984
|
+
}
|
|
985
|
+
function nextUnsortedSegmentLine(mappings, start) {
|
|
986
|
+
for (let i = start; i < mappings.length; i++) if (!isSorted(mappings[i])) return i;
|
|
987
|
+
return mappings.length;
|
|
988
|
+
}
|
|
989
|
+
function isSorted(line) {
|
|
990
|
+
for (let j = 1; j < line.length; j++) if (line[j][COLUMN$1] < line[j - 1][COLUMN$1]) return false;
|
|
991
|
+
return true;
|
|
992
|
+
}
|
|
993
|
+
function sortSegments(line, owned) {
|
|
994
|
+
if (!owned) line = line.slice();
|
|
995
|
+
return line.sort(sortComparator);
|
|
996
|
+
}
|
|
997
|
+
function sortComparator(a, b) {
|
|
998
|
+
return a[COLUMN$1] - b[COLUMN$1];
|
|
999
|
+
}
|
|
1000
|
+
function memoizedState() {
|
|
1001
|
+
return {
|
|
1002
|
+
lastKey: -1,
|
|
1003
|
+
lastNeedle: -1,
|
|
1004
|
+
lastIndex: -1
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
function parse(map) {
|
|
1008
|
+
return typeof map === "string" ? JSON.parse(map) : map;
|
|
1009
|
+
}
|
|
1010
|
+
var TraceMap = class {
|
|
1011
|
+
constructor(map, mapUrl) {
|
|
1012
|
+
const isString = typeof map === "string";
|
|
1013
|
+
if (!isString && map._decodedMemo) return map;
|
|
1014
|
+
const parsed = parse(map);
|
|
1015
|
+
const { version: version2, file, names: names2, sourceRoot, sources, sourcesContent } = parsed;
|
|
1016
|
+
this.version = version2;
|
|
1017
|
+
this.file = file;
|
|
1018
|
+
this.names = names2 || [];
|
|
1019
|
+
this.sourceRoot = sourceRoot;
|
|
1020
|
+
this.sources = sources;
|
|
1021
|
+
this.sourcesContent = sourcesContent;
|
|
1022
|
+
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
|
|
1023
|
+
const resolve2 = resolver(mapUrl, sourceRoot);
|
|
1024
|
+
this.resolvedSources = sources.map(resolve2);
|
|
1025
|
+
const { mappings } = parsed;
|
|
1026
|
+
if (typeof mappings === "string") {
|
|
1027
|
+
this._encoded = mappings;
|
|
1028
|
+
this._decoded = void 0;
|
|
1029
|
+
} else if (Array.isArray(mappings)) {
|
|
1030
|
+
this._encoded = void 0;
|
|
1031
|
+
this._decoded = maybeSort(mappings, isString);
|
|
1032
|
+
} else if (parsed.sections) throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
|
|
1033
|
+
else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
|
|
1034
|
+
this._decodedMemo = memoizedState();
|
|
1035
|
+
this._bySources = void 0;
|
|
1036
|
+
this._bySourceMemos = void 0;
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
function cast$1(map) {
|
|
1040
|
+
return map;
|
|
1041
|
+
}
|
|
1042
|
+
function decodedMappings(map) {
|
|
1043
|
+
var _a;
|
|
1044
|
+
return (_a = cast$1(map))._decoded || (_a._decoded = decode(cast$1(map)._encoded));
|
|
1045
|
+
}
|
|
1046
|
+
function eachMapping(map, cb) {
|
|
1047
|
+
const decoded = decodedMappings(map);
|
|
1048
|
+
const { names: names2, resolvedSources } = map;
|
|
1049
|
+
for (let i = 0; i < decoded.length; i++) {
|
|
1050
|
+
const line = decoded[i];
|
|
1051
|
+
for (let j = 0; j < line.length; j++) {
|
|
1052
|
+
const seg = line[j];
|
|
1053
|
+
const generatedLine = i + 1;
|
|
1054
|
+
const generatedColumn = seg[0];
|
|
1055
|
+
let source = null;
|
|
1056
|
+
let originalLine = null;
|
|
1057
|
+
let originalColumn = null;
|
|
1058
|
+
let name = null;
|
|
1059
|
+
if (seg.length !== 1) {
|
|
1060
|
+
source = resolvedSources[seg[1]];
|
|
1061
|
+
originalLine = seg[2] + 1;
|
|
1062
|
+
originalColumn = seg[3];
|
|
1063
|
+
}
|
|
1064
|
+
if (seg.length === 5) name = names2[seg[4]];
|
|
1065
|
+
cb({
|
|
1066
|
+
generatedLine,
|
|
1067
|
+
generatedColumn,
|
|
1068
|
+
source,
|
|
1069
|
+
originalLine,
|
|
1070
|
+
originalColumn,
|
|
1071
|
+
name
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
var SetArray = class {
|
|
1077
|
+
constructor() {
|
|
1078
|
+
this._indexes = { __proto__: null };
|
|
1079
|
+
this.array = [];
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
function cast(set) {
|
|
1083
|
+
return set;
|
|
1084
|
+
}
|
|
1085
|
+
function get(setarr, key) {
|
|
1086
|
+
return cast(setarr)._indexes[key];
|
|
1087
|
+
}
|
|
1088
|
+
function put(setarr, key) {
|
|
1089
|
+
const index = get(setarr, key);
|
|
1090
|
+
if (index !== void 0) return index;
|
|
1091
|
+
const { array, _indexes: indexes } = cast(setarr);
|
|
1092
|
+
return indexes[key] = array.push(key) - 1;
|
|
1093
|
+
}
|
|
1094
|
+
var COLUMN = 0;
|
|
1095
|
+
var SOURCES_INDEX = 1;
|
|
1096
|
+
var SOURCE_LINE = 2;
|
|
1097
|
+
var SOURCE_COLUMN = 3;
|
|
1098
|
+
var NAMES_INDEX = 4;
|
|
1099
|
+
var NO_NAME = -1;
|
|
1100
|
+
var GenMapping = class {
|
|
1101
|
+
constructor({ file, sourceRoot } = {}) {
|
|
1102
|
+
this._names = new SetArray();
|
|
1103
|
+
this._sources = new SetArray();
|
|
1104
|
+
this._sourcesContent = [];
|
|
1105
|
+
this._mappings = [];
|
|
1106
|
+
this.file = file;
|
|
1107
|
+
this.sourceRoot = sourceRoot;
|
|
1108
|
+
this._ignoreList = new SetArray();
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
function cast2(map) {
|
|
1112
|
+
return map;
|
|
1113
|
+
}
|
|
1114
|
+
function addMapping(map, mapping) {
|
|
1115
|
+
return addMappingInternal(false, map, mapping);
|
|
1116
|
+
}
|
|
1117
|
+
function toDecodedMap(map) {
|
|
1118
|
+
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names2, _ignoreList: ignoreList2 } = cast2(map);
|
|
1119
|
+
removeEmptyFinalLines(mappings);
|
|
1120
|
+
return {
|
|
1121
|
+
version: 3,
|
|
1122
|
+
file: map.file || void 0,
|
|
1123
|
+
names: names2.array,
|
|
1124
|
+
sourceRoot: map.sourceRoot || void 0,
|
|
1125
|
+
sources: sources.array,
|
|
1126
|
+
sourcesContent,
|
|
1127
|
+
mappings,
|
|
1128
|
+
ignoreList: ignoreList2.array
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
function toEncodedMap(map) {
|
|
1132
|
+
const decoded = toDecodedMap(map);
|
|
1133
|
+
return Object.assign({}, decoded, { mappings: encode(decoded.mappings) });
|
|
1134
|
+
}
|
|
1135
|
+
function fromMap(input) {
|
|
1136
|
+
const map = new TraceMap(input);
|
|
1137
|
+
const gen = new GenMapping({
|
|
1138
|
+
file: map.file,
|
|
1139
|
+
sourceRoot: map.sourceRoot
|
|
1140
|
+
});
|
|
1141
|
+
putAll(cast2(gen)._names, map.names);
|
|
1142
|
+
putAll(cast2(gen)._sources, map.sources);
|
|
1143
|
+
cast2(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null);
|
|
1144
|
+
cast2(gen)._mappings = decodedMappings(map);
|
|
1145
|
+
if (map.ignoreList) putAll(cast2(gen)._ignoreList, map.ignoreList);
|
|
1146
|
+
return gen;
|
|
1147
|
+
}
|
|
1148
|
+
function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) {
|
|
1149
|
+
const { _mappings: mappings, _sources: sources, _sourcesContent: sourcesContent, _names: names2 } = cast2(map);
|
|
1150
|
+
const line = getIndex(mappings, genLine);
|
|
1151
|
+
const index = getColumnIndex(line, genColumn);
|
|
1152
|
+
if (!source) {
|
|
1153
|
+
if (skipable && skipSourceless(line, index)) return;
|
|
1154
|
+
return insert(line, index, [genColumn]);
|
|
1155
|
+
}
|
|
1156
|
+
assert(sourceLine);
|
|
1157
|
+
assert(sourceColumn);
|
|
1158
|
+
const sourcesIndex = put(sources, source);
|
|
1159
|
+
const namesIndex = name ? put(names2, name) : NO_NAME;
|
|
1160
|
+
if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null;
|
|
1161
|
+
if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) return;
|
|
1162
|
+
return insert(line, index, name ? [
|
|
1163
|
+
genColumn,
|
|
1164
|
+
sourcesIndex,
|
|
1165
|
+
sourceLine,
|
|
1166
|
+
sourceColumn,
|
|
1167
|
+
namesIndex
|
|
1168
|
+
] : [
|
|
1169
|
+
genColumn,
|
|
1170
|
+
sourcesIndex,
|
|
1171
|
+
sourceLine,
|
|
1172
|
+
sourceColumn
|
|
1173
|
+
]);
|
|
1174
|
+
}
|
|
1175
|
+
function assert(_val) {
|
|
1176
|
+
}
|
|
1177
|
+
function getIndex(arr, index) {
|
|
1178
|
+
for (let i = arr.length; i <= index; i++) arr[i] = [];
|
|
1179
|
+
return arr[index];
|
|
1180
|
+
}
|
|
1181
|
+
function getColumnIndex(line, genColumn) {
|
|
1182
|
+
let index = line.length;
|
|
1183
|
+
for (let i = index - 1; i >= 0; index = i--) if (genColumn >= line[i][COLUMN]) break;
|
|
1184
|
+
return index;
|
|
1185
|
+
}
|
|
1186
|
+
function insert(array, index, value) {
|
|
1187
|
+
for (let i = array.length; i > index; i--) array[i] = array[i - 1];
|
|
1188
|
+
array[index] = value;
|
|
1189
|
+
}
|
|
1190
|
+
function removeEmptyFinalLines(mappings) {
|
|
1191
|
+
const { length } = mappings;
|
|
1192
|
+
let len = length;
|
|
1193
|
+
for (let i = len - 1; i >= 0; len = i, i--) if (mappings[i].length > 0) break;
|
|
1194
|
+
if (len < length) mappings.length = len;
|
|
1195
|
+
}
|
|
1196
|
+
function putAll(setarr, array) {
|
|
1197
|
+
for (let i = 0; i < array.length; i++) put(setarr, array[i]);
|
|
1198
|
+
}
|
|
1199
|
+
function skipSourceless(line, index) {
|
|
1200
|
+
if (index === 0) return true;
|
|
1201
|
+
return line[index - 1].length === 1;
|
|
1202
|
+
}
|
|
1203
|
+
function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) {
|
|
1204
|
+
if (index === 0) return false;
|
|
1205
|
+
const prev = line[index - 1];
|
|
1206
|
+
if (prev.length === 1) return false;
|
|
1207
|
+
return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME);
|
|
1208
|
+
}
|
|
1209
|
+
function addMappingInternal(skipable, map, mapping) {
|
|
1210
|
+
const { generated, source, original, name, content } = mapping;
|
|
1211
|
+
if (!source) return addSegmentInternal(skipable, map, generated.line - 1, generated.column, null, null, null, null, null);
|
|
1212
|
+
assert(original);
|
|
1213
|
+
return addSegmentInternal(skipable, map, generated.line - 1, generated.column, source, original.line - 1, original.column, name, content);
|
|
1214
|
+
}
|
|
1215
|
+
function coerce(value) {
|
|
1216
|
+
if (value instanceof Error) return value.stack || value.message;
|
|
1217
|
+
return value;
|
|
1218
|
+
}
|
|
1219
|
+
function selectColor(colors2, namespace) {
|
|
1220
|
+
let hash = 0;
|
|
1221
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
1222
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
1223
|
+
hash |= 0;
|
|
1224
|
+
}
|
|
1225
|
+
return colors2[Math.abs(hash) % colors2.length];
|
|
1226
|
+
}
|
|
1227
|
+
function matchesTemplate(search, template) {
|
|
1228
|
+
let searchIndex = 0;
|
|
1229
|
+
let templateIndex = 0;
|
|
1230
|
+
let starIndex = -1;
|
|
1231
|
+
let matchIndex = 0;
|
|
1232
|
+
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
1233
|
+
starIndex = templateIndex;
|
|
1234
|
+
matchIndex = searchIndex;
|
|
1235
|
+
templateIndex++;
|
|
1236
|
+
} else {
|
|
1237
|
+
searchIndex++;
|
|
1238
|
+
templateIndex++;
|
|
1239
|
+
}
|
|
1240
|
+
else if (starIndex !== -1) {
|
|
1241
|
+
templateIndex = starIndex + 1;
|
|
1242
|
+
matchIndex++;
|
|
1243
|
+
searchIndex = matchIndex;
|
|
1244
|
+
} else return false;
|
|
1245
|
+
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
1246
|
+
return templateIndex === template.length;
|
|
1247
|
+
}
|
|
1248
|
+
function humanize(value) {
|
|
1249
|
+
if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
|
|
1250
|
+
return `${value}ms`;
|
|
1251
|
+
}
|
|
1252
|
+
var globalNamespaces = "";
|
|
1253
|
+
function createDebug$1(namespace, options) {
|
|
1254
|
+
let prevTime;
|
|
1255
|
+
let enableOverride;
|
|
1256
|
+
let namespacesCache;
|
|
1257
|
+
let enabledCache;
|
|
1258
|
+
const debug2 = (...args) => {
|
|
1259
|
+
if (!debug2.enabled) return;
|
|
1260
|
+
const curr = Date.now();
|
|
1261
|
+
const diff = curr - (prevTime || curr);
|
|
1262
|
+
prevTime = curr;
|
|
1263
|
+
args[0] = coerce(args[0]);
|
|
1264
|
+
if (typeof args[0] !== "string") args.unshift("%O");
|
|
1265
|
+
let index = 0;
|
|
1266
|
+
args[0] = args[0].replace(/%([a-z%])/gi, (match, format) => {
|
|
1267
|
+
if (match === "%%") return "%";
|
|
1268
|
+
index++;
|
|
1269
|
+
const formatter = options.formatters[format];
|
|
1270
|
+
if (typeof formatter === "function") {
|
|
1271
|
+
const value = args[index];
|
|
1272
|
+
match = formatter.call(debug2, value);
|
|
1273
|
+
args.splice(index, 1);
|
|
1274
|
+
index--;
|
|
1275
|
+
}
|
|
1276
|
+
return match;
|
|
1277
|
+
});
|
|
1278
|
+
options.formatArgs.call(debug2, diff, args);
|
|
1279
|
+
debug2.log(...args);
|
|
1280
|
+
};
|
|
1281
|
+
debug2.extend = function(namespace$1, delimiter = ":") {
|
|
1282
|
+
return createDebug$1(this.namespace + delimiter + namespace$1, {
|
|
1283
|
+
useColors: this.useColors,
|
|
1284
|
+
color: this.color,
|
|
1285
|
+
formatArgs: this.formatArgs,
|
|
1286
|
+
formatters: this.formatters,
|
|
1287
|
+
inspectOpts: this.inspectOpts,
|
|
1288
|
+
log: this.log,
|
|
1289
|
+
humanize: this.humanize
|
|
1290
|
+
});
|
|
1291
|
+
};
|
|
1292
|
+
Object.assign(debug2, options);
|
|
1293
|
+
debug2.namespace = namespace;
|
|
1294
|
+
Object.defineProperty(debug2, "enabled", {
|
|
1295
|
+
enumerable: true,
|
|
1296
|
+
configurable: false,
|
|
1297
|
+
get: () => {
|
|
1298
|
+
if (enableOverride != null) return enableOverride;
|
|
1299
|
+
if (namespacesCache !== globalNamespaces) {
|
|
1300
|
+
namespacesCache = globalNamespaces;
|
|
1301
|
+
enabledCache = enabled(namespace);
|
|
1302
|
+
}
|
|
1303
|
+
return enabledCache;
|
|
1304
|
+
},
|
|
1305
|
+
set: (v) => {
|
|
1306
|
+
enableOverride = v;
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
return debug2;
|
|
1310
|
+
}
|
|
1311
|
+
var names = [];
|
|
1312
|
+
var skips = [];
|
|
1313
|
+
function enable(namespaces$1) {
|
|
1314
|
+
globalNamespaces = namespaces$1;
|
|
1315
|
+
names = [];
|
|
1316
|
+
skips = [];
|
|
1317
|
+
const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
1318
|
+
for (const ns of split) if (ns[0] === "-") skips.push(ns.slice(1));
|
|
1319
|
+
else names.push(ns);
|
|
1320
|
+
}
|
|
1321
|
+
function enabled(name) {
|
|
1322
|
+
for (const skip of skips) if (matchesTemplate(name, skip)) return false;
|
|
1323
|
+
for (const ns of names) if (matchesTemplate(name, ns)) return true;
|
|
1324
|
+
return false;
|
|
1325
|
+
}
|
|
1326
|
+
var colors = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [
|
|
1327
|
+
20,
|
|
1328
|
+
21,
|
|
1329
|
+
26,
|
|
1330
|
+
27,
|
|
1331
|
+
32,
|
|
1332
|
+
33,
|
|
1333
|
+
38,
|
|
1334
|
+
39,
|
|
1335
|
+
40,
|
|
1336
|
+
41,
|
|
1337
|
+
42,
|
|
1338
|
+
43,
|
|
1339
|
+
44,
|
|
1340
|
+
45,
|
|
1341
|
+
56,
|
|
1342
|
+
57,
|
|
1343
|
+
62,
|
|
1344
|
+
63,
|
|
1345
|
+
68,
|
|
1346
|
+
69,
|
|
1347
|
+
74,
|
|
1348
|
+
75,
|
|
1349
|
+
76,
|
|
1350
|
+
77,
|
|
1351
|
+
78,
|
|
1352
|
+
79,
|
|
1353
|
+
80,
|
|
1354
|
+
81,
|
|
1355
|
+
92,
|
|
1356
|
+
93,
|
|
1357
|
+
98,
|
|
1358
|
+
99,
|
|
1359
|
+
112,
|
|
1360
|
+
113,
|
|
1361
|
+
128,
|
|
1362
|
+
129,
|
|
1363
|
+
134,
|
|
1364
|
+
135,
|
|
1365
|
+
148,
|
|
1366
|
+
149,
|
|
1367
|
+
160,
|
|
1368
|
+
161,
|
|
1369
|
+
162,
|
|
1370
|
+
163,
|
|
1371
|
+
164,
|
|
1372
|
+
165,
|
|
1373
|
+
166,
|
|
1374
|
+
167,
|
|
1375
|
+
168,
|
|
1376
|
+
169,
|
|
1377
|
+
170,
|
|
1378
|
+
171,
|
|
1379
|
+
172,
|
|
1380
|
+
173,
|
|
1381
|
+
178,
|
|
1382
|
+
179,
|
|
1383
|
+
184,
|
|
1384
|
+
185,
|
|
1385
|
+
196,
|
|
1386
|
+
197,
|
|
1387
|
+
198,
|
|
1388
|
+
199,
|
|
1389
|
+
200,
|
|
1390
|
+
201,
|
|
1391
|
+
202,
|
|
1392
|
+
203,
|
|
1393
|
+
204,
|
|
1394
|
+
205,
|
|
1395
|
+
206,
|
|
1396
|
+
207,
|
|
1397
|
+
208,
|
|
1398
|
+
209,
|
|
1399
|
+
214,
|
|
1400
|
+
215,
|
|
1401
|
+
220,
|
|
1402
|
+
221
|
|
1403
|
+
] : [
|
|
1404
|
+
6,
|
|
1405
|
+
2,
|
|
1406
|
+
3,
|
|
1407
|
+
4,
|
|
1408
|
+
5,
|
|
1409
|
+
1
|
|
1410
|
+
];
|
|
1411
|
+
var inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => {
|
|
1412
|
+
const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase());
|
|
1413
|
+
let value = process.env[key];
|
|
1414
|
+
const lowerCase = typeof value === "string" && value.toLowerCase();
|
|
1415
|
+
if (value === "null") value = null;
|
|
1416
|
+
else if (lowerCase === "yes" || lowerCase === "on" || lowerCase === "true" || lowerCase === "enabled") value = true;
|
|
1417
|
+
else if (lowerCase === "no" || lowerCase === "off" || lowerCase === "false" || lowerCase === "disabled") value = false;
|
|
1418
|
+
else value = Number(value);
|
|
1419
|
+
obj[prop] = value;
|
|
1420
|
+
return obj;
|
|
1421
|
+
}, {});
|
|
1422
|
+
function useColors() {
|
|
1423
|
+
return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd);
|
|
1424
|
+
}
|
|
1425
|
+
function getDate() {
|
|
1426
|
+
if (inspectOpts.hideDate) return "";
|
|
1427
|
+
return `${(/* @__PURE__ */ new Date()).toISOString()} `;
|
|
1428
|
+
}
|
|
1429
|
+
function formatArgs(diff, args) {
|
|
1430
|
+
const { namespace: name, useColors: useColors$1 } = this;
|
|
1431
|
+
if (useColors$1) {
|
|
1432
|
+
const c = this.color;
|
|
1433
|
+
const colorCode = `\x1B[3${c < 8 ? c : `8;5;${c}`}`;
|
|
1434
|
+
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
1435
|
+
args[0] = prefix + args[0].split("\n").join(`
|
|
1436
|
+
${prefix}`);
|
|
1437
|
+
args.push(`${colorCode}m+${this.humanize(diff)}\x1B[0m`);
|
|
1438
|
+
} else args[0] = `${getDate()}${name} ${args[0]}`;
|
|
1439
|
+
}
|
|
1440
|
+
function log(...args) {
|
|
1441
|
+
process.stderr.write(`${formatWithOptions(this.inspectOpts, ...args)}
|
|
1442
|
+
`);
|
|
1443
|
+
}
|
|
1444
|
+
var defaultOptions = {
|
|
1445
|
+
useColors: useColors(),
|
|
1446
|
+
formatArgs,
|
|
1447
|
+
formatters: {
|
|
1448
|
+
o(v) {
|
|
1449
|
+
this.inspectOpts.colors = this.useColors;
|
|
1450
|
+
return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
1451
|
+
},
|
|
1452
|
+
O(v) {
|
|
1453
|
+
this.inspectOpts.colors = this.useColors;
|
|
1454
|
+
return inspect(v, this.inspectOpts);
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
inspectOpts,
|
|
1458
|
+
log,
|
|
1459
|
+
humanize
|
|
1460
|
+
};
|
|
1461
|
+
function createDebug(namespace, options) {
|
|
1462
|
+
var _ref;
|
|
1463
|
+
const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
|
|
1464
|
+
return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options));
|
|
1465
|
+
}
|
|
1466
|
+
enable(process.env.DEBUG || "");
|
|
1467
|
+
var debug = createDebug("vite:hmr");
|
|
1468
|
+
async function handleHotUpdate({ file, modules, read }, options, customElement, typeDepModules) {
|
|
1469
|
+
const prevDescriptor = getDescriptor(file, options, false, true);
|
|
1470
|
+
if (!prevDescriptor) return;
|
|
1471
|
+
const { descriptor } = createDescriptor(file, await read(), options, true);
|
|
1472
|
+
let needRerender = false;
|
|
1473
|
+
const nonJsModules = modules.filter((m) => m.type !== "js");
|
|
1474
|
+
const jsModules = modules.filter((m) => m.type === "js");
|
|
1475
|
+
const affectedModules = new Set(nonJsModules);
|
|
1476
|
+
const mainModule = getMainModule(jsModules);
|
|
1477
|
+
const templateModule = jsModules.find((m) => /type=template/.test(m.url));
|
|
1478
|
+
resolveScript(descriptor, options, false, customElement);
|
|
1479
|
+
const scriptChanged = hasScriptChanged(prevDescriptor, descriptor);
|
|
1480
|
+
if (scriptChanged) affectedModules.add(getScriptModule(jsModules) || mainModule);
|
|
1481
|
+
if (!isEqualBlock(descriptor.template, prevDescriptor.template)) {
|
|
1482
|
+
if (!scriptChanged) setResolvedScript(descriptor, getResolvedScript(prevDescriptor, false), false);
|
|
1483
|
+
affectedModules.add(templateModule);
|
|
1484
|
+
needRerender = true;
|
|
1485
|
+
}
|
|
1486
|
+
let didUpdateStyle = false;
|
|
1487
|
+
const prevStyles = prevDescriptor.styles || [];
|
|
1488
|
+
const nextStyles = descriptor.styles || [];
|
|
1489
|
+
if (prevDescriptor.cssVars.join("") !== descriptor.cssVars.join("")) affectedModules.add(mainModule);
|
|
1490
|
+
if (prevStyles.some((s) => s.scoped) !== nextStyles.some((s) => s.scoped)) {
|
|
1491
|
+
affectedModules.add(templateModule);
|
|
1492
|
+
affectedModules.add(mainModule);
|
|
1493
|
+
}
|
|
1494
|
+
for (let i = 0; i < nextStyles.length; i++) {
|
|
1495
|
+
const prev = prevStyles[i];
|
|
1496
|
+
const next = nextStyles[i];
|
|
1497
|
+
if (!prev || !isEqualBlock(prev, next)) {
|
|
1498
|
+
didUpdateStyle = true;
|
|
1499
|
+
const mod = jsModules.find((m) => m.url.includes(`type=style&index=${i}`) && m.url.endsWith(`.${next.lang || "css"}`));
|
|
1500
|
+
if (mod) {
|
|
1501
|
+
affectedModules.add(mod);
|
|
1502
|
+
if (mod.url.includes("&inline")) affectedModules.add(mainModule);
|
|
1503
|
+
} else affectedModules.add(mainModule);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
if (prevStyles.length > nextStyles.length) affectedModules.add(mainModule);
|
|
1507
|
+
const prevCustoms = prevDescriptor.customBlocks || [];
|
|
1508
|
+
const nextCustoms = descriptor.customBlocks || [];
|
|
1509
|
+
if (prevCustoms.length !== nextCustoms.length) affectedModules.add(mainModule);
|
|
1510
|
+
else for (let i = 0; i < nextCustoms.length; i++) {
|
|
1511
|
+
const prev = prevCustoms[i];
|
|
1512
|
+
const next = nextCustoms[i];
|
|
1513
|
+
if (!prev || !isEqualBlock(prev, next)) {
|
|
1514
|
+
const mod = jsModules.find((m) => m.url.includes(`type=${prev.type}&index=${i}`));
|
|
1515
|
+
if (mod) affectedModules.add(mod);
|
|
1516
|
+
else affectedModules.add(mainModule);
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
const updateType = [];
|
|
1520
|
+
if (needRerender) {
|
|
1521
|
+
updateType.push(`template`);
|
|
1522
|
+
if (!templateModule) affectedModules.add(mainModule);
|
|
1523
|
+
else if (mainModule && !affectedModules.has(mainModule)) [...mainModule.importers].filter((m) => isCSSRequest(m.url)).forEach((m) => affectedModules.add(m));
|
|
1524
|
+
}
|
|
1525
|
+
if (didUpdateStyle) updateType.push(`style`);
|
|
1526
|
+
if (updateType.length) {
|
|
1527
|
+
if (file.endsWith(".vue")) invalidateDescriptor(file);
|
|
1528
|
+
else cache.set(file, descriptor);
|
|
1529
|
+
debug(`[vue:update(${updateType.join("&")})] ${file}`);
|
|
1530
|
+
}
|
|
1531
|
+
return [...affectedModules, ...typeDepModules || []].filter(Boolean);
|
|
1532
|
+
}
|
|
1533
|
+
function isEqualBlock(a, b) {
|
|
1534
|
+
if (!a && !b) return true;
|
|
1535
|
+
if (!a || !b) return false;
|
|
1536
|
+
if (a.src && b.src && a.src === b.src) return true;
|
|
1537
|
+
if (a.content !== b.content) return false;
|
|
1538
|
+
const keysA = Object.keys(a.attrs);
|
|
1539
|
+
const keysB = Object.keys(b.attrs);
|
|
1540
|
+
if (keysA.length !== keysB.length) return false;
|
|
1541
|
+
return keysA.every((key) => a.attrs[key] === b.attrs[key]);
|
|
1542
|
+
}
|
|
1543
|
+
function isOnlyTemplateChanged(prev, next) {
|
|
1544
|
+
return !hasScriptChanged(prev, next) && prev.styles.length === next.styles.length && prev.styles.every((s, i) => isEqualBlock(s, next.styles[i])) && prev.customBlocks.length === next.customBlocks.length && prev.customBlocks.every((s, i) => isEqualBlock(s, next.customBlocks[i]));
|
|
1545
|
+
}
|
|
1546
|
+
function deepEqual(obj1, obj2, excludeProps = [], deepParentsOfObj1 = []) {
|
|
1547
|
+
if (typeof obj1 !== typeof obj2) return false;
|
|
1548
|
+
if (obj1 == null || obj2 == null || typeof obj1 !== "object" || deepParentsOfObj1.includes(obj1)) return obj1 === obj2;
|
|
1549
|
+
const keys1 = Object.keys(obj1);
|
|
1550
|
+
const keys2 = Object.keys(obj2);
|
|
1551
|
+
if (keys1.length !== keys2.length) return false;
|
|
1552
|
+
for (const key of keys1) {
|
|
1553
|
+
if (excludeProps.includes(key)) continue;
|
|
1554
|
+
if (!deepEqual(obj1[key], obj2[key], excludeProps, [...deepParentsOfObj1, obj1])) return false;
|
|
1555
|
+
}
|
|
1556
|
+
return true;
|
|
1557
|
+
}
|
|
1558
|
+
function isEqualAst(prev, next) {
|
|
1559
|
+
if (typeof prev === "undefined" || typeof next === "undefined") return prev === next;
|
|
1560
|
+
if (prev.length !== next.length) return false;
|
|
1561
|
+
for (let i = 0; i < prev.length; i++) {
|
|
1562
|
+
const prevNode = prev[i];
|
|
1563
|
+
const nextNode = next[i];
|
|
1564
|
+
if (!deepEqual(prevNode, nextNode, [
|
|
1565
|
+
"start",
|
|
1566
|
+
"end",
|
|
1567
|
+
"loc",
|
|
1568
|
+
"range",
|
|
1569
|
+
"leadingComments",
|
|
1570
|
+
"trailingComments",
|
|
1571
|
+
"innerComments",
|
|
1572
|
+
"_ownerScope",
|
|
1573
|
+
"_resolvedReference",
|
|
1574
|
+
"_resolvedElements"
|
|
1575
|
+
])) return false;
|
|
1576
|
+
}
|
|
1577
|
+
return true;
|
|
1578
|
+
}
|
|
1579
|
+
function hasScriptChanged(prev, next) {
|
|
1580
|
+
if (prev.vapor !== next.vapor) return true;
|
|
1581
|
+
const prevScript = getResolvedScript(prev, false);
|
|
1582
|
+
const nextScript = getResolvedScript(next, false);
|
|
1583
|
+
if (!isEqualBlock(prev.script, next.script) && !isEqualAst(prevScript?.scriptAst, nextScript?.scriptAst)) return true;
|
|
1584
|
+
if (!isEqualBlock(prev.scriptSetup, next.scriptSetup) && !isEqualAst(prevScript?.scriptSetupAst, nextScript?.scriptSetupAst)) return true;
|
|
1585
|
+
const prevImports = getResolvedScript(prev, false)?.imports;
|
|
1586
|
+
if (prevImports) return !next.template || next.shouldForceReload(prevImports);
|
|
1587
|
+
return false;
|
|
1588
|
+
}
|
|
1589
|
+
function getMainModule(jsModules) {
|
|
1590
|
+
return jsModules.filter((m) => !/type=/.test(m.url) || /type=script/.test(m.url)).sort((m1, m2) => {
|
|
1591
|
+
return m1.url.length - m2.url.length;
|
|
1592
|
+
})[0];
|
|
1593
|
+
}
|
|
1594
|
+
function getScriptModule(jsModules) {
|
|
1595
|
+
return jsModules.find((m) => /type=script.*&lang\.\w+$/.test(m.url));
|
|
1596
|
+
}
|
|
1597
|
+
function handleTypeDepChange(affectedComponents, { modules, server: { moduleGraph } }) {
|
|
1598
|
+
const affected = /* @__PURE__ */ new Set();
|
|
1599
|
+
for (const file of affectedComponents) {
|
|
1600
|
+
invalidateScript(file);
|
|
1601
|
+
const mods = moduleGraph.getModulesByFile(file);
|
|
1602
|
+
if (mods) {
|
|
1603
|
+
const arr = [...mods];
|
|
1604
|
+
affected.add(getScriptModule(arr) || getMainModule(arr));
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
return [...modules, ...affected];
|
|
1608
|
+
}
|
|
1609
|
+
var EXPORT_HELPER_ID = "\0plugin-vue:export-helper";
|
|
1610
|
+
var helperCode = `
|
|
1611
|
+
export default (sfc, props) => {
|
|
1612
|
+
const target = sfc.__vccOpts || sfc;
|
|
1613
|
+
for (const [key, val] of props) {
|
|
1614
|
+
target[key] = val;
|
|
1615
|
+
}
|
|
1616
|
+
return target;
|
|
1617
|
+
}
|
|
1618
|
+
`;
|
|
1619
|
+
async function transformMain(code, filename, options, pluginContext, ssr, customElement) {
|
|
1620
|
+
const { devServer, isProduction, devToolsEnabled } = options;
|
|
1621
|
+
const prevDescriptor = getPrevDescriptor(filename);
|
|
1622
|
+
const { descriptor, errors } = createDescriptor(filename, code, options);
|
|
1623
|
+
if (fs2.existsSync(filename)) getDescriptor(filename, options, true, true, filename.endsWith(".vue") ? void 0 : code);
|
|
1624
|
+
if (errors.length) {
|
|
1625
|
+
errors.forEach((error) => pluginContext.error(createRollupError(filename, error)));
|
|
1626
|
+
return null;
|
|
1627
|
+
}
|
|
1628
|
+
const attachedProps = [];
|
|
1629
|
+
const hasScoped = descriptor.styles.some((s) => s.scoped);
|
|
1630
|
+
const isTemplateOnlyVapor = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
|
|
1631
|
+
const { code: scriptCode, map: scriptMap } = await genScriptCode(descriptor, options, pluginContext, ssr, customElement);
|
|
1632
|
+
const hasTemplateImport = descriptor.template && !isUseInlineTemplate(descriptor, options);
|
|
1633
|
+
const isTemplateInlined = !!descriptor.template && (!descriptor.template.lang || descriptor.template.lang === "html") && !descriptor.template.src;
|
|
1634
|
+
let templateCode = "";
|
|
1635
|
+
let templateMap = void 0;
|
|
1636
|
+
let templateMultiRoot;
|
|
1637
|
+
if (hasTemplateImport) ({ code: templateCode, map: templateMap, multiRoot: templateMultiRoot } = await genTemplateCode(descriptor, options, pluginContext, ssr, customElement));
|
|
1638
|
+
if (hasTemplateImport) attachedProps.push(ssr ? ["ssrRender", "_sfc_ssrRender"] : ["render", "_sfc_render"]);
|
|
1639
|
+
else if (prevDescriptor && !isEqualBlock(descriptor.template, prevDescriptor.template)) attachedProps.push([ssr ? "ssrRender" : "render", "() => {}"]);
|
|
1640
|
+
const stylesCode = await genStyleCode(descriptor, pluginContext, customElement, attachedProps);
|
|
1641
|
+
const customBlocksCode = await genCustomBlockCode(descriptor, pluginContext);
|
|
1642
|
+
const output = [
|
|
1643
|
+
scriptCode,
|
|
1644
|
+
templateCode,
|
|
1645
|
+
isTemplateOnlyVapor ? `${scriptIdentifier}.__multiRoot = ${isTemplateInlined ? templateMultiRoot : "_sfc_multiRoot"}` : "",
|
|
1646
|
+
stylesCode,
|
|
1647
|
+
customBlocksCode
|
|
1648
|
+
];
|
|
1649
|
+
if (hasScoped) attachedProps.push([`__scopeId`, JSON.stringify(`data-v-${descriptor.id}`)]);
|
|
1650
|
+
if (devToolsEnabled || devServer && !isProduction) attachedProps.push([`__file`, JSON.stringify(isProduction ? path2.basename(filename) : filename)]);
|
|
1651
|
+
if (devServer && devServer.config.server.hmr !== false && !ssr && !isProduction) {
|
|
1652
|
+
output.push(`_sfc_main.__hmrId = ${JSON.stringify(descriptor.id)}`);
|
|
1653
|
+
output.push("typeof __VUE_HMR_RUNTIME__ !== 'undefined' && __VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)");
|
|
1654
|
+
output.push(`import.meta.hot.on('file-changed', ({ file }) => {`, ` __VUE_HMR_RUNTIME__.CHANGED_FILE = file`, `})`);
|
|
1655
|
+
if (prevDescriptor && isOnlyTemplateChanged(prevDescriptor, descriptor)) output.push(`export const _rerender_only = __VUE_HMR_RUNTIME__.CHANGED_FILE === ${JSON.stringify(normalizePath(filename))}`);
|
|
1656
|
+
output.push(`import.meta.hot.accept(mod => {`, ` if (!mod) return`, ` const { default: updated, _rerender_only } = mod`, ` if (_rerender_only) {`, ` __VUE_HMR_RUNTIME__.rerender(updated.__hmrId, updated.render)`, ` } else {`, ` __VUE_HMR_RUNTIME__.reload(updated.__hmrId, updated)`, ` }`, `})`);
|
|
1657
|
+
}
|
|
1658
|
+
if (ssr) {
|
|
1659
|
+
const normalizedFilename = normalizePath(path2.relative(options.root, filename));
|
|
1660
|
+
output.push(`import { useSSRContext as __vite_useSSRContext } from 'vue'`, `const _sfc_setup = _sfc_main.setup`, `_sfc_main.setup = (props, ctx) => {`, ` const ssrContext = __vite_useSSRContext()`, ` ;(ssrContext.modules || (ssrContext.modules = new Set())).add(${JSON.stringify(normalizedFilename)})`, ` return _sfc_setup ? _sfc_setup(props, ctx) : undefined`, `}`);
|
|
1661
|
+
}
|
|
1662
|
+
let resolvedMap = void 0;
|
|
1663
|
+
if (options.sourceMap) if (templateMap) {
|
|
1664
|
+
const gen = fromMap(scriptMap ?? {
|
|
1665
|
+
file: filename,
|
|
1666
|
+
sourceRoot: "",
|
|
1667
|
+
version: 3,
|
|
1668
|
+
sources: [],
|
|
1669
|
+
sourcesContent: [],
|
|
1670
|
+
names: [],
|
|
1671
|
+
mappings: ""
|
|
1672
|
+
});
|
|
1673
|
+
const tracer = new TraceMap(templateMap);
|
|
1674
|
+
const offset = (scriptCode.match(/\r?\n/g)?.length ?? 0) + 1;
|
|
1675
|
+
eachMapping(tracer, (m) => {
|
|
1676
|
+
if (m.source == null) return;
|
|
1677
|
+
addMapping(gen, {
|
|
1678
|
+
source: m.source,
|
|
1679
|
+
original: {
|
|
1680
|
+
line: m.originalLine,
|
|
1681
|
+
column: m.originalColumn
|
|
1682
|
+
},
|
|
1683
|
+
generated: {
|
|
1684
|
+
line: m.generatedLine + offset,
|
|
1685
|
+
column: m.generatedColumn
|
|
1686
|
+
}
|
|
1687
|
+
});
|
|
1688
|
+
});
|
|
1689
|
+
resolvedMap = toEncodedMap(gen);
|
|
1690
|
+
resolvedMap.sourcesContent = templateMap.sourcesContent;
|
|
1691
|
+
} else resolvedMap = scriptMap;
|
|
1692
|
+
if (!attachedProps.length) output.push(`export default _sfc_main`);
|
|
1693
|
+
else output.push(`import _export_sfc from '${EXPORT_HELPER_ID}'`, `export default /*#__PURE__*/_export_sfc(_sfc_main, [${attachedProps.map(([key, val]) => `['${key}',${val}]`).join(",")}])`);
|
|
1694
|
+
let resolvedCode = output.join("\n");
|
|
1695
|
+
const lang = descriptor.scriptSetup?.lang || descriptor.script?.lang;
|
|
1696
|
+
if (lang && /tsx?$/.test(lang) && !descriptor.script?.src) {
|
|
1697
|
+
const { transformWithOxc } = await import("vite");
|
|
1698
|
+
if (transformWithOxc) {
|
|
1699
|
+
const { code: code2, map } = await transformWithOxc(resolvedCode, filename, {
|
|
1700
|
+
...options.devServer?.config.oxc,
|
|
1701
|
+
lang: "ts",
|
|
1702
|
+
sourcemap: options.sourceMap
|
|
1703
|
+
}, resolvedMap);
|
|
1704
|
+
resolvedCode = code2;
|
|
1705
|
+
resolvedMap = resolvedMap ? map : resolvedMap;
|
|
1706
|
+
} else {
|
|
1707
|
+
const { code: code2, map } = await transformWithEsbuild(resolvedCode, filename, {
|
|
1708
|
+
target: "esnext",
|
|
1709
|
+
charset: "utf8",
|
|
1710
|
+
...options.devServer?.config.esbuild,
|
|
1711
|
+
loader: "ts",
|
|
1712
|
+
sourcemap: options.sourceMap
|
|
1713
|
+
}, resolvedMap);
|
|
1714
|
+
resolvedCode = code2;
|
|
1715
|
+
resolvedMap = resolvedMap ? map : resolvedMap;
|
|
1716
|
+
}
|
|
1717
|
+
}
|
|
1718
|
+
return {
|
|
1719
|
+
code: resolvedCode,
|
|
1720
|
+
map: resolvedMap || { mappings: "" },
|
|
1721
|
+
meta: { vite: { lang: descriptor.script?.lang || descriptor.scriptSetup?.lang || "js" } }
|
|
1722
|
+
};
|
|
1723
|
+
}
|
|
1724
|
+
async function genTemplateCode(descriptor, options, pluginContext, ssr, customElement) {
|
|
1725
|
+
const template = descriptor.template;
|
|
1726
|
+
const hasScoped = descriptor.styles.some((style) => style.scoped);
|
|
1727
|
+
const needsMultiRoot = !descriptor.script && !descriptor.scriptSetup && descriptor.vapor;
|
|
1728
|
+
if ((!template.lang || template.lang === "html") && !template.src) {
|
|
1729
|
+
const result = transformTemplateInMain(template.content, descriptor, options, pluginContext, ssr, customElement);
|
|
1730
|
+
return {
|
|
1731
|
+
...result,
|
|
1732
|
+
multiRoot: needsMultiRoot ? result.multiRoot : void 0
|
|
1733
|
+
};
|
|
1734
|
+
} else {
|
|
1735
|
+
if (template.src) await linkSrcToDescriptor(template.src, descriptor, pluginContext, hasScoped);
|
|
1736
|
+
const src = template.src || descriptor.filename;
|
|
1737
|
+
const query = `?vue&type=template${template.src ? hasScoped ? `&src=${descriptor.id}` : "&src=true" : ""}${hasScoped ? `&scoped=${descriptor.id}` : ``}${attrsToQuery(template.attrs, "js", true)}`;
|
|
1738
|
+
const request = JSON.stringify(src + query);
|
|
1739
|
+
const renderFnName = ssr ? "ssrRender" : "render";
|
|
1740
|
+
return {
|
|
1741
|
+
code: `import { ${renderFnName} as _sfc_${renderFnName}${needsMultiRoot ? ", multiRoot as _sfc_multiRoot" : ""} } from ${request}`,
|
|
1742
|
+
map: void 0
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
}
|
|
1746
|
+
async function genScriptCode(descriptor, options, pluginContext, ssr, customElement) {
|
|
1747
|
+
let scriptCode = `const ${scriptIdentifier} = { ${descriptor.vapor ? "__vapor: true" : ""} }`;
|
|
1748
|
+
let map;
|
|
1749
|
+
const script = resolveScript(descriptor, options, ssr, customElement);
|
|
1750
|
+
if (script) if (canInlineMain(descriptor, options)) {
|
|
1751
|
+
if (!options.compiler.version) {
|
|
1752
|
+
const userPlugins = options.script?.babelParserPlugins || [];
|
|
1753
|
+
const defaultPlugins = script.lang === "ts" ? userPlugins.includes("decorators") ? ["typescript"] : ["typescript", "decorators-legacy"] : [];
|
|
1754
|
+
scriptCode = options.compiler.rewriteDefault(script.content, scriptIdentifier, [...defaultPlugins, ...userPlugins]);
|
|
1755
|
+
} else scriptCode = script.content;
|
|
1756
|
+
map = script.map;
|
|
1757
|
+
} else {
|
|
1758
|
+
if (script.src) await linkSrcToDescriptor(script.src, descriptor, pluginContext, false);
|
|
1759
|
+
const src = script.src || descriptor.filename;
|
|
1760
|
+
const langFallback = script.src && path2.extname(src).slice(1) || "js";
|
|
1761
|
+
const attrsQuery = attrsToQuery(script.attrs, langFallback);
|
|
1762
|
+
const query = `?vue&type=script${script.src ? `&src=true` : ``}${attrsQuery}`;
|
|
1763
|
+
const request = JSON.stringify(src + query);
|
|
1764
|
+
scriptCode = `import _sfc_main from ${request}
|
|
1765
|
+
export * from ${request}`;
|
|
1766
|
+
}
|
|
1767
|
+
return {
|
|
1768
|
+
code: scriptCode,
|
|
1769
|
+
map
|
|
1770
|
+
};
|
|
1771
|
+
}
|
|
1772
|
+
async function genStyleCode(descriptor, pluginContext, customElement, attachedProps) {
|
|
1773
|
+
let stylesCode = ``;
|
|
1774
|
+
let cssModulesMap;
|
|
1775
|
+
if (descriptor.styles.length) {
|
|
1776
|
+
for (let i = 0; i < descriptor.styles.length; i++) {
|
|
1777
|
+
const style = descriptor.styles[i];
|
|
1778
|
+
if (style.src) await linkSrcToDescriptor(style.src, descriptor, pluginContext, style.scoped);
|
|
1779
|
+
const src = style.src || descriptor.filename;
|
|
1780
|
+
const attrsQuery = attrsToQuery(style.attrs, "css");
|
|
1781
|
+
const srcQuery = style.src ? style.scoped ? `&src=${descriptor.id}` : "&src=true" : "";
|
|
1782
|
+
const directQuery = customElement ? `&inline` : ``;
|
|
1783
|
+
const scopedQuery = style.scoped ? `&scoped=${descriptor.id}` : ``;
|
|
1784
|
+
const styleRequest = src + `?vue&type=style&index=${i}${srcQuery}${directQuery}${scopedQuery}` + attrsQuery;
|
|
1785
|
+
if (style.module) {
|
|
1786
|
+
if (customElement) throw new Error(`<style module> is not supported in custom elements mode.`);
|
|
1787
|
+
const [importCode, nameMap] = genCSSModulesCode(i, styleRequest, style.module);
|
|
1788
|
+
stylesCode += importCode;
|
|
1789
|
+
Object.assign(cssModulesMap ||= {}, nameMap);
|
|
1790
|
+
} else if (customElement) stylesCode += `
|
|
1791
|
+
import _style_${i} from ${JSON.stringify(styleRequest)}`;
|
|
1792
|
+
else stylesCode += `
|
|
1793
|
+
import ${JSON.stringify(styleRequest)}`;
|
|
1794
|
+
}
|
|
1795
|
+
if (customElement) attachedProps.push([`styles`, `[${descriptor.styles.map((_, i) => `_style_${i}`).join(",")}]`]);
|
|
1796
|
+
}
|
|
1797
|
+
if (cssModulesMap) {
|
|
1798
|
+
const mappingCode = Object.entries(cssModulesMap).reduce((code, [key, value]) => code + `"${key}":${value},
|
|
1799
|
+
`, "{\n") + "}";
|
|
1800
|
+
stylesCode += `
|
|
1801
|
+
const cssModules = ${mappingCode}`;
|
|
1802
|
+
attachedProps.push([`__cssModules`, `cssModules`]);
|
|
1803
|
+
}
|
|
1804
|
+
return stylesCode;
|
|
1805
|
+
}
|
|
1806
|
+
function genCSSModulesCode(index, request, moduleName) {
|
|
1807
|
+
const styleVar = `style${index}`;
|
|
1808
|
+
const exposedName = typeof moduleName === "string" ? moduleName : "$style";
|
|
1809
|
+
const moduleRequest = request.replace(/\.(\w+)$/, ".module.$1");
|
|
1810
|
+
return [`
|
|
1811
|
+
import ${styleVar} from ${JSON.stringify(moduleRequest)}`, { [exposedName]: styleVar }];
|
|
1812
|
+
}
|
|
1813
|
+
async function genCustomBlockCode(descriptor, pluginContext) {
|
|
1814
|
+
let code = "";
|
|
1815
|
+
for (let index = 0; index < descriptor.customBlocks.length; index++) {
|
|
1816
|
+
const block = descriptor.customBlocks[index];
|
|
1817
|
+
if (block.src) await linkSrcToDescriptor(block.src, descriptor, pluginContext, false);
|
|
1818
|
+
const src = block.src || descriptor.filename;
|
|
1819
|
+
const attrsQuery = attrsToQuery(block.attrs, block.type);
|
|
1820
|
+
const srcQuery = block.src ? `&src=true` : ``;
|
|
1821
|
+
const query = `?vue&type=${block.type}&index=${index}${srcQuery}${attrsQuery}`;
|
|
1822
|
+
const request = JSON.stringify(src + query);
|
|
1823
|
+
code += `import block${index} from ${request}
|
|
1824
|
+
`;
|
|
1825
|
+
code += `if (typeof block${index} === 'function') block${index}(_sfc_main)
|
|
1826
|
+
`;
|
|
1827
|
+
}
|
|
1828
|
+
return code;
|
|
1829
|
+
}
|
|
1830
|
+
async function linkSrcToDescriptor(src, descriptor, pluginContext, scoped) {
|
|
1831
|
+
setSrcDescriptor(((await pluginContext.resolve(src, descriptor.filename))?.id || src).replace(/\?.*$/, ""), descriptor, scoped);
|
|
1832
|
+
}
|
|
1833
|
+
var ignoreList = [
|
|
1834
|
+
"id",
|
|
1835
|
+
"index",
|
|
1836
|
+
"src",
|
|
1837
|
+
"type",
|
|
1838
|
+
"lang",
|
|
1839
|
+
"module",
|
|
1840
|
+
"scoped",
|
|
1841
|
+
"generic"
|
|
1842
|
+
];
|
|
1843
|
+
function attrsToQuery(attrs, langFallback, forceLangFallback = false) {
|
|
1844
|
+
let query = ``;
|
|
1845
|
+
for (const name in attrs) {
|
|
1846
|
+
const value = attrs[name];
|
|
1847
|
+
if (!ignoreList.includes(name)) query += `&${encodeURIComponent(name)}${value ? `=${encodeURIComponent(value)}` : ``}`;
|
|
1848
|
+
}
|
|
1849
|
+
if (langFallback || attrs.lang) query += `lang` in attrs ? forceLangFallback ? `&lang.${langFallback}` : `&lang.${attrs.lang}` : `&lang.${langFallback}`;
|
|
1850
|
+
return query;
|
|
1851
|
+
}
|
|
1852
|
+
async function transformStyle(code, descriptor, index, options, pluginContext, filename) {
|
|
1853
|
+
const block = descriptor.styles[index];
|
|
1854
|
+
const result = await options.compiler.compileStyleAsync({
|
|
1855
|
+
...options.style,
|
|
1856
|
+
filename: descriptor.filename,
|
|
1857
|
+
id: `data-v-${descriptor.id}`,
|
|
1858
|
+
isProd: options.isProduction,
|
|
1859
|
+
source: code,
|
|
1860
|
+
scoped: block.scoped,
|
|
1861
|
+
...options.cssDevSourcemap ? { postcssOptions: { map: {
|
|
1862
|
+
from: filename,
|
|
1863
|
+
inline: false,
|
|
1864
|
+
annotation: false
|
|
1865
|
+
} } } : {}
|
|
1866
|
+
});
|
|
1867
|
+
if (result.errors.length) {
|
|
1868
|
+
result.errors.forEach((error) => {
|
|
1869
|
+
if (error.line && error.column) error.loc = {
|
|
1870
|
+
file: descriptor.filename,
|
|
1871
|
+
line: error.line + block.loc.start.line,
|
|
1872
|
+
column: error.column
|
|
1873
|
+
};
|
|
1874
|
+
pluginContext.error(error);
|
|
1875
|
+
});
|
|
1876
|
+
return null;
|
|
1877
|
+
}
|
|
1878
|
+
const map = result.map ? await formatPostcssSourceMap(result.map, filename) : { mappings: "" };
|
|
1879
|
+
return {
|
|
1880
|
+
code: result.code,
|
|
1881
|
+
map,
|
|
1882
|
+
meta: block.scoped && !descriptor.isTemp ? { vite: { cssScopeTo: [descriptor.filename, "default"] } } : void 0
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
function vuePlugin(rawOptions = {}) {
|
|
1886
|
+
clearScriptCache();
|
|
1887
|
+
const options = shallowRef({
|
|
1888
|
+
isProduction: process.env.NODE_ENV === "production",
|
|
1889
|
+
compiler: null,
|
|
1890
|
+
customElement: /\.ce\.vue$/,
|
|
1891
|
+
...rawOptions,
|
|
1892
|
+
root: process.cwd(),
|
|
1893
|
+
sourceMap: true,
|
|
1894
|
+
cssDevSourcemap: false
|
|
1895
|
+
});
|
|
1896
|
+
const include = shallowRef(rawOptions.include ?? /\.vue$/);
|
|
1897
|
+
const exclude = shallowRef(rawOptions.exclude);
|
|
1898
|
+
let optionsHookIsCalled = false;
|
|
1899
|
+
const filter = computed(() => createFilter(include.value, exclude.value));
|
|
1900
|
+
const customElementFilter = computed(() => {
|
|
1901
|
+
const customElement = options.value.features?.customElement || options.value.customElement;
|
|
1902
|
+
return typeof customElement === "boolean" ? () => customElement : createFilter(customElement);
|
|
1903
|
+
});
|
|
1904
|
+
let transformCachedModule = false;
|
|
1905
|
+
const plugin = {
|
|
1906
|
+
name: "vite:vue",
|
|
1907
|
+
api: {
|
|
1908
|
+
get options() {
|
|
1909
|
+
return options.value;
|
|
1910
|
+
},
|
|
1911
|
+
set options(value) {
|
|
1912
|
+
options.value = value;
|
|
1913
|
+
},
|
|
1914
|
+
get include() {
|
|
1915
|
+
return include.value;
|
|
1916
|
+
},
|
|
1917
|
+
set include(value) {
|
|
1918
|
+
if (optionsHookIsCalled) throw new Error("include cannot be updated after `options` hook is called");
|
|
1919
|
+
include.value = value;
|
|
1920
|
+
},
|
|
1921
|
+
get exclude() {
|
|
1922
|
+
return exclude.value;
|
|
1923
|
+
},
|
|
1924
|
+
set exclude(value) {
|
|
1925
|
+
if (optionsHookIsCalled) throw new Error("exclude cannot be updated after `options` hook is called");
|
|
1926
|
+
exclude.value = value;
|
|
1927
|
+
},
|
|
1928
|
+
version
|
|
1929
|
+
},
|
|
1930
|
+
handleHotUpdate(ctx) {
|
|
1931
|
+
ctx.server.ws.send({
|
|
1932
|
+
type: "custom",
|
|
1933
|
+
event: "file-changed",
|
|
1934
|
+
data: { file: normalizePath(ctx.file) }
|
|
1935
|
+
});
|
|
1936
|
+
if (options.value.compiler.invalidateTypeCache) options.value.compiler.invalidateTypeCache(ctx.file);
|
|
1937
|
+
let typeDepModules;
|
|
1938
|
+
const matchesFilter = filter.value(ctx.file);
|
|
1939
|
+
if (typeDepToSFCMap.has(ctx.file)) {
|
|
1940
|
+
typeDepModules = handleTypeDepChange(typeDepToSFCMap.get(ctx.file), ctx);
|
|
1941
|
+
if (!matchesFilter) return typeDepModules;
|
|
1942
|
+
}
|
|
1943
|
+
if (matchesFilter) return handleHotUpdate(ctx, options.value, customElementFilter.value(ctx.file), typeDepModules);
|
|
1944
|
+
},
|
|
1945
|
+
config(config) {
|
|
1946
|
+
const parseDefine = (v) => {
|
|
1947
|
+
try {
|
|
1948
|
+
return typeof v === "string" ? JSON.parse(v) : v;
|
|
1949
|
+
} catch (err) {
|
|
1950
|
+
return v;
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
return {
|
|
1954
|
+
resolve: { dedupe: config.build?.ssr ? [] : ["vue"] },
|
|
1955
|
+
define: {
|
|
1956
|
+
__VUE_OPTIONS_API__: options.value.features?.optionsAPI ?? parseDefine(config.define?.__VUE_OPTIONS_API__) ?? true,
|
|
1957
|
+
__VUE_PROD_DEVTOOLS__: (options.value.features?.prodDevtools || parseDefine(config.define?.__VUE_PROD_DEVTOOLS__)) ?? false,
|
|
1958
|
+
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: (options.value.features?.prodHydrationMismatchDetails || parseDefine(config.define?.__VUE_PROD_HYDRATION_MISMATCH_DETAILS__)) ?? false
|
|
1959
|
+
},
|
|
1960
|
+
ssr: { external: config.legacy?.buildSsrCjsExternalHeuristics ? ["vue", "@vue/server-renderer"] : [] }
|
|
1961
|
+
};
|
|
1962
|
+
},
|
|
1963
|
+
configResolved(config) {
|
|
1964
|
+
options.value = {
|
|
1965
|
+
...options.value,
|
|
1966
|
+
root: config.root,
|
|
1967
|
+
sourceMap: config.command === "build" ? !!config.build.sourcemap : true,
|
|
1968
|
+
cssDevSourcemap: config.css?.devSourcemap ?? false,
|
|
1969
|
+
isProduction: config.isProduction,
|
|
1970
|
+
devToolsEnabled: !!(options.value.features?.prodDevtools || config.define.__VUE_PROD_DEVTOOLS__ || !config.isProduction)
|
|
1971
|
+
};
|
|
1972
|
+
const _warn = config.logger.warn;
|
|
1973
|
+
config.logger.warn = (...args) => {
|
|
1974
|
+
if (args[0].match(/\[lightningcss\] '(deep|slotted|global)' is not recognized as a valid pseudo-/)) return;
|
|
1975
|
+
_warn(...args);
|
|
1976
|
+
};
|
|
1977
|
+
transformCachedModule = config.command === "build" && options.value.sourceMap && config.build.watch != null;
|
|
1978
|
+
},
|
|
1979
|
+
options() {
|
|
1980
|
+
optionsHookIsCalled = true;
|
|
1981
|
+
plugin.transform.filter = { id: {
|
|
1982
|
+
include: [...makeIdFiltersToMatchWithQuery(ensureArray(include.value)), /[?&]vue\b/],
|
|
1983
|
+
exclude: exclude.value
|
|
1984
|
+
} };
|
|
1985
|
+
},
|
|
1986
|
+
shouldTransformCachedModule({ id }) {
|
|
1987
|
+
if (transformCachedModule && parseVueRequest(id).query.vue) return true;
|
|
1988
|
+
return false;
|
|
1989
|
+
},
|
|
1990
|
+
configureServer(server) {
|
|
1991
|
+
options.value.devServer = server;
|
|
1992
|
+
},
|
|
1993
|
+
buildStart() {
|
|
1994
|
+
const compiler = options.value.compiler = options.value.compiler || resolveCompiler(options.value.root);
|
|
1995
|
+
if (compiler.invalidateTypeCache) options.value.devServer?.watcher.on("unlink", (file) => {
|
|
1996
|
+
compiler.invalidateTypeCache(file);
|
|
1997
|
+
});
|
|
1998
|
+
},
|
|
1999
|
+
resolveId: {
|
|
2000
|
+
filter: { id: [exactRegex(EXPORT_HELPER_ID), /[?&]vue\b/] },
|
|
2001
|
+
handler(id) {
|
|
2002
|
+
if (id === "\0plugin-vue:export-helper") return id;
|
|
2003
|
+
if (parseVueRequest(id).query.vue) return id;
|
|
2004
|
+
}
|
|
2005
|
+
},
|
|
2006
|
+
load: {
|
|
2007
|
+
filter: { id: [exactRegex(EXPORT_HELPER_ID), /[?&]vue\b/] },
|
|
2008
|
+
handler(id, opt) {
|
|
2009
|
+
if (id === "\0plugin-vue:export-helper") return helperCode;
|
|
2010
|
+
const ssr = opt?.ssr === true;
|
|
2011
|
+
const { filename, query } = parseVueRequest(id);
|
|
2012
|
+
if (query.vue) {
|
|
2013
|
+
if (query.src) return fs2.readFileSync(filename, "utf-8");
|
|
2014
|
+
const descriptor = getDescriptor(filename, options.value);
|
|
2015
|
+
let block;
|
|
2016
|
+
if (query.type === "script") block = resolveScript(descriptor, options.value, ssr, customElementFilter.value(filename));
|
|
2017
|
+
else if (query.type === "template") block = descriptor.template;
|
|
2018
|
+
else if (query.type === "style") block = descriptor.styles[query.index];
|
|
2019
|
+
else if (query.index != null) block = descriptor.customBlocks[query.index];
|
|
2020
|
+
if (block) return {
|
|
2021
|
+
code: block.content,
|
|
2022
|
+
map: block.map
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
},
|
|
2027
|
+
transform: { handler(code, id, opt) {
|
|
2028
|
+
const ssr = opt?.ssr === true;
|
|
2029
|
+
const { filename, query } = parseVueRequest(id);
|
|
2030
|
+
if (query.raw || query.url) return;
|
|
2031
|
+
if (!filter.value(filename) && !query.vue) return;
|
|
2032
|
+
if (!query.vue) return transformMain(code, filename, options.value, this, ssr, customElementFilter.value(filename));
|
|
2033
|
+
else {
|
|
2034
|
+
const descriptor = query.src ? getSrcDescriptor(filename, query) || getTempSrcDescriptor(filename, query) : getDescriptor(filename, options.value);
|
|
2035
|
+
if (query.src) this.addWatchFile(filename);
|
|
2036
|
+
if (query.type === "template") return transformTemplateAsModule(code, filename, descriptor, options.value, this, ssr, customElementFilter.value(filename));
|
|
2037
|
+
else if (query.type === "style") return transformStyle(code, descriptor, Number(query.index || 0), options.value, this, filename);
|
|
2038
|
+
}
|
|
2039
|
+
} }
|
|
2040
|
+
};
|
|
2041
|
+
return plugin;
|
|
2042
|
+
}
|
|
2043
|
+
function ensureArray(value) {
|
|
2044
|
+
return Array.isArray(value) ? value : [value];
|
|
2045
|
+
}
|
|
2046
|
+
function vuePluginCjs(options) {
|
|
2047
|
+
return vuePlugin.call(this, options);
|
|
2048
|
+
}
|
|
2049
|
+
Object.assign(vuePluginCjs, {
|
|
2050
|
+
default: vuePluginCjs,
|
|
2051
|
+
parseVueRequest
|
|
2052
|
+
});
|
|
2053
|
+
|
|
2054
|
+
// src/vite/config/vite-obfuscation-config.ts
|
|
2055
|
+
var defaultBaseOptions = () => {
|
|
2056
|
+
return {
|
|
2057
|
+
// 是否压紧输出代码,尽量减少空格、换行
|
|
2058
|
+
compact: true,
|
|
2059
|
+
// 是否把正常控制流打散、改写成更难读的状态机式结构
|
|
2060
|
+
controlFlowFlattening: false,
|
|
2061
|
+
// 是否注入无用的假代码
|
|
2062
|
+
deadCodeInjection: false,
|
|
2063
|
+
// 是否把字符串抽到数组里再间接访问
|
|
2064
|
+
stringArray: true,
|
|
2065
|
+
// 控制有多少比例的字符串会被放进 stringArray 0.00-1.00
|
|
2066
|
+
stringArrayThreshold: 0.75,
|
|
2067
|
+
// 是否把字符串拆碎后再拼接
|
|
2068
|
+
splitStrings: false,
|
|
2069
|
+
// 变量名/函数名用什么风格生成,hexadecimal=十六进制风格
|
|
2070
|
+
identifierNamesGenerator: "hexadecimal",
|
|
2071
|
+
// 是否重命名全局变量/全局作用域名字
|
|
2072
|
+
renameGlobals: false
|
|
2073
|
+
};
|
|
2074
|
+
};
|
|
2075
|
+
var defaultConfig2 = () => {
|
|
2076
|
+
const baseOptions = defaultBaseOptions();
|
|
2077
|
+
return {
|
|
2078
|
+
// 主进程
|
|
2079
|
+
main: {
|
|
2080
|
+
enabled: true,
|
|
2081
|
+
options: {
|
|
2082
|
+
...baseOptions,
|
|
2083
|
+
target: "node"
|
|
2084
|
+
}
|
|
2085
|
+
},
|
|
2086
|
+
// 预加载进程
|
|
2087
|
+
preload: {
|
|
2088
|
+
enabled: true,
|
|
2089
|
+
options: {
|
|
2090
|
+
...baseOptions,
|
|
2091
|
+
target: "browser-no-eval"
|
|
2092
|
+
}
|
|
2093
|
+
},
|
|
2094
|
+
// 渲染进程
|
|
2095
|
+
renderer: {
|
|
2096
|
+
enabled: false,
|
|
2097
|
+
// 排除 vite 拆包后不需要混淆的文件
|
|
2098
|
+
exclude: new RegExp(`^assets\\/(js\\/)?(${BuildChunk.obfuscateExcludePrefix}).*\\.js$`),
|
|
2099
|
+
options: {
|
|
2100
|
+
...baseOptions,
|
|
2101
|
+
target: "browser-no-eval"
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
};
|
|
2105
|
+
};
|
|
2106
|
+
var defineViteObfuscationConfig = (override) => {
|
|
2107
|
+
return ObjectUtil.merge(defaultConfig2(), override ?? {});
|
|
2108
|
+
};
|
|
2109
|
+
|
|
2110
|
+
// src/vite/config/electron-vite-config.ts
|
|
2111
|
+
import path3 from "node:path";
|
|
2112
|
+
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
|
|
2113
|
+
import Components from "unplugin-vue-components/vite";
|
|
2114
|
+
var defaultConfig3 = (options) => {
|
|
2115
|
+
const likeProd = ViteMode.likeProd(options.env);
|
|
2116
|
+
const obfuscationConfig = defineViteObfuscationConfig(options?.obfuscationConfig);
|
|
2117
|
+
const componentsDts = options.componentsDts ?? path3.resolve(options.rootDir, "types/xion-components.d.ts");
|
|
2118
|
+
const componentsAutoImport = options.componentsAutoImport ?? true;
|
|
2119
|
+
return {
|
|
2120
|
+
// 主进程(electron)
|
|
2121
|
+
main: {
|
|
2122
|
+
resolve: {
|
|
2123
|
+
alias: options.aliases
|
|
2124
|
+
},
|
|
2125
|
+
plugins: [
|
|
2126
|
+
// js 代码混淆
|
|
2127
|
+
BuildObfuscation.plugin(options.env, obfuscationConfig?.main),
|
|
2128
|
+
// 插入自定义插件
|
|
2129
|
+
...options?.plugins?.main ?? []
|
|
2130
|
+
],
|
|
2131
|
+
build: {
|
|
2132
|
+
externalizeDeps: true,
|
|
2133
|
+
lib: {
|
|
2134
|
+
entry: path3.resolve(options.rootDir, "electron/main/index.ts")
|
|
2135
|
+
},
|
|
2136
|
+
outDir: "out/main",
|
|
2137
|
+
sourcemap: likeProd ? false : "inline"
|
|
2138
|
+
}
|
|
2139
|
+
},
|
|
2140
|
+
// 渲染进程
|
|
2141
|
+
preload: {
|
|
2142
|
+
resolve: {
|
|
2143
|
+
alias: options.aliases
|
|
2144
|
+
},
|
|
2145
|
+
plugins: [
|
|
2146
|
+
// js 代码混淆
|
|
2147
|
+
BuildObfuscation.plugin(options.env, obfuscationConfig?.preload),
|
|
2148
|
+
// 插入自定义插件
|
|
2149
|
+
...options?.plugins?.preload ?? []
|
|
2150
|
+
],
|
|
2151
|
+
build: {
|
|
2152
|
+
// Sandboxed preload needs bundled third-party deps instead of externalized imports.
|
|
2153
|
+
externalizeDeps: false,
|
|
2154
|
+
lib: {
|
|
2155
|
+
entry: path3.resolve(options.rootDir, "electron/preload/index.ts"),
|
|
2156
|
+
formats: ["cjs"]
|
|
2157
|
+
},
|
|
2158
|
+
outDir: "out/preload",
|
|
2159
|
+
sourcemap: likeProd ? false : "inline"
|
|
2160
|
+
}
|
|
2161
|
+
},
|
|
2162
|
+
// 渲染进程(Vue3)
|
|
2163
|
+
renderer: {
|
|
2164
|
+
root: path3.resolve(options.rootDir, "renderer"),
|
|
2165
|
+
resolve: {
|
|
2166
|
+
alias: options.aliases,
|
|
2167
|
+
dedupe: [
|
|
2168
|
+
"vue",
|
|
2169
|
+
"pinia",
|
|
2170
|
+
"element-plus",
|
|
2171
|
+
"@element-plus/icons-vue"
|
|
2172
|
+
]
|
|
2173
|
+
},
|
|
2174
|
+
server: {
|
|
2175
|
+
host: "127.0.0.1",
|
|
2176
|
+
port: 8899,
|
|
2177
|
+
strictPort: true
|
|
2178
|
+
},
|
|
2179
|
+
plugins: [
|
|
2180
|
+
vuePlugin(),
|
|
2181
|
+
// Xion 组件自动导入
|
|
2182
|
+
componentsAutoImport && Components({
|
|
2183
|
+
dts: componentsDts,
|
|
2184
|
+
resolvers: [
|
|
2185
|
+
XionComponentResolver(),
|
|
2186
|
+
ElementPlusResolver({ importStyle: "css" })
|
|
2187
|
+
],
|
|
2188
|
+
types: [
|
|
2189
|
+
{
|
|
2190
|
+
from: "@e-xi/xion/renderer/components",
|
|
2191
|
+
names: Object.keys(XionComponentMap)
|
|
2192
|
+
}
|
|
2193
|
+
]
|
|
2194
|
+
}),
|
|
2195
|
+
// Content-Security-Policy
|
|
2196
|
+
BuildCspUpdate.plugin(options.scpDomains, options.electronAppConfig.rendererProtocol),
|
|
2197
|
+
// js 代码混淆
|
|
2198
|
+
BuildObfuscation.plugin(options.env, obfuscationConfig?.renderer),
|
|
2199
|
+
// 插入自定义插件
|
|
2200
|
+
...options?.plugins?.renderer ?? []
|
|
2201
|
+
],
|
|
2202
|
+
build: {
|
|
2203
|
+
assetsInlineLimit: 4096,
|
|
2204
|
+
chunkSizeWarningLimit: 4096,
|
|
2205
|
+
cssCodeSplit: true,
|
|
2206
|
+
minify: "terser",
|
|
2207
|
+
outDir: "out/renderer",
|
|
2208
|
+
sourcemap: likeProd ? false : "inline",
|
|
2209
|
+
rollupOptions: {
|
|
2210
|
+
input: {
|
|
2211
|
+
main: path3.resolve(options.rootDir, "renderer/index.html")
|
|
2212
|
+
},
|
|
2213
|
+
output: {
|
|
2214
|
+
chunkFileNames: `assets/js/[name]-[hash:16].js`,
|
|
2215
|
+
entryFileNames: `assets/js/[name]-[hash:16].js`,
|
|
2216
|
+
assetFileNames: `assets/[ext]/[name]-[hash:16].[ext]`,
|
|
2217
|
+
manualChunks: (id) => BuildChunk.manualChunks(id)
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
terserOptions: {
|
|
2221
|
+
compress: {
|
|
2222
|
+
// 生产环境去除 console
|
|
2223
|
+
drop_console: true,
|
|
2224
|
+
// 生产环境去除 debugger
|
|
2225
|
+
drop_debugger: true
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
};
|
|
2231
|
+
};
|
|
2232
|
+
var defineElectronViteConfig = (options, override) => {
|
|
2233
|
+
override ??= {};
|
|
2234
|
+
const baseConfig = defaultConfig3(options);
|
|
2235
|
+
const mergedConfig = ObjectUtil.merge(
|
|
2236
|
+
baseConfig,
|
|
2237
|
+
override,
|
|
2238
|
+
{
|
|
2239
|
+
undefined: "override"
|
|
2240
|
+
}
|
|
2241
|
+
);
|
|
2242
|
+
FileWriteViteUtil.writeXionTypes(options.rootDir, options.xionTypesDts);
|
|
2243
|
+
RuntimeConfigViteUtil.writeFile(
|
|
2244
|
+
mergedConfig,
|
|
2245
|
+
{
|
|
2246
|
+
appMode: ViteMode.getMode(options.env),
|
|
2247
|
+
mainOutDir: mergedConfig?.main?.build?.outDir,
|
|
2248
|
+
preloadOutDir: mergedConfig?.preload?.build?.outDir,
|
|
2249
|
+
rendererOutDir: mergedConfig?.renderer?.build?.outDir
|
|
2250
|
+
}
|
|
2251
|
+
);
|
|
2252
|
+
return mergedConfig;
|
|
2253
|
+
};
|
|
2254
|
+
export {
|
|
2255
|
+
defineElectronAppConfig,
|
|
2256
|
+
defineElectronBuilderConfig,
|
|
2257
|
+
defineElectronViteConfig,
|
|
2258
|
+
defineViteObfuscationConfig
|
|
2259
|
+
};
|