From: Eduardo San Martin Morote Date: Tue, 31 Oct 2023 10:45:27 +0000 (+0100) Subject: fix: support webpack minification X-Git-Tag: @pinia/nuxt@0.5.2-beta.0~100 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57914b522fb901701c397a5ef62dad3339ee0cf9;p=thirdparty%2Fvuejs%2Fpinia.git fix: support webpack minification Fix #1143 --- diff --git a/packages/pinia/src/createPinia.ts b/packages/pinia/src/createPinia.ts index fe2f0194..ccf8b1fd 100644 --- a/packages/pinia/src/createPinia.ts +++ b/packages/pinia/src/createPinia.ts @@ -1,7 +1,7 @@ import { Pinia, PiniaPlugin, setActivePinia, piniaSymbol } from './rootStore' import { ref, App, markRaw, effectScope, isVue2, Ref } from 'vue-demi' import { registerPiniaDevtools, devtoolsPlugin } from './devtools' -import { USE_DEVTOOLS } from './env' +import { IS_CLIENT } from './env' import { StateTree, StoreGeneric } from './types' /** @@ -29,7 +29,7 @@ export function createPinia(): Pinia { app.provide(piniaSymbol, pinia) app.config.globalProperties.$pinia = pinia /* istanbul ignore else */ - if (USE_DEVTOOLS) { + if (__USE_DEVTOOLS__ && IS_CLIENT) { registerPiniaDevtools(app, pinia) } toBeInstalled.forEach((plugin) => _p.push(plugin)) @@ -57,7 +57,8 @@ export function createPinia(): Pinia { // pinia devtools rely on dev only features so they cannot be forced unless // the dev build of Vue is used. Avoid old browsers like IE11. - if (USE_DEVTOOLS && typeof Proxy !== 'undefined') { + if (__USE_DEVTOOLS__ && typeof Proxy !== 'undefined') { + console.log('GREP blank') pinia.use(devtoolsPlugin) } diff --git a/packages/pinia/src/env.ts b/packages/pinia/src/env.ts index d54ffbbd..53538e85 100644 --- a/packages/pinia/src/env.ts +++ b/packages/pinia/src/env.ts @@ -1,10 +1 @@ export const IS_CLIENT = typeof window !== 'undefined' - -/** - * Should we add the devtools plugins. - * - only if dev mode or forced through the prod devtools flag - * - not in test - * - only if window exists (could change in the future) - */ -export const USE_DEVTOOLS = - (__DEV__ || __FEATURE_PROD_DEVTOOLS__) && !__TEST__ && IS_CLIENT diff --git a/packages/pinia/src/global.d.ts b/packages/pinia/src/global.d.ts index ecff968b..a574cb7e 100644 --- a/packages/pinia/src/global.d.ts +++ b/packages/pinia/src/global.d.ts @@ -3,6 +3,7 @@ declare var __DEV__: boolean declare var __TEST__: boolean declare var __FEATURE_PROD_DEVTOOLS__: boolean declare var __BROWSER__: boolean +declare var __USE_DEVTOOLS__: boolean declare var __CI__: boolean declare var __VUE_DEVTOOLS_TOAST__: ( message: string, diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index d9a36d97..e781da0d 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -48,7 +48,7 @@ import { _StoreWithState, } from './types' import { setActivePinia, piniaSymbol, Pinia, activePinia } from './rootStore' -import { IS_CLIENT, USE_DEVTOOLS } from './env' +import { IS_CLIENT } from './env' import { patchObject } from './hmr' import { addSubscription, triggerSubscriptions, noop } from './subscriptions' @@ -379,7 +379,7 @@ function createSetupStore< onError, }) - let ret: any + let ret: unknown try { ret = action.apply(this && this.$id === $id ? this : store, args) // handle sync errors @@ -458,7 +458,7 @@ function createSetupStore< } const store: Store = reactive( - __DEV__ || USE_DEVTOOLS + __DEV__ || (__USE_DEVTOOLS__ && IS_CLIENT) ? assign( { _hmrPayload, @@ -668,7 +668,7 @@ function createSetupStore< }) } - if (USE_DEVTOOLS) { + if (__USE_DEVTOOLS__ && IS_CLIENT) { const nonEnumerable = { writable: true, configurable: true, @@ -697,7 +697,7 @@ function createSetupStore< // apply all plugins pinia._p.forEach((extender) => { /* istanbul ignore else */ - if (USE_DEVTOOLS) { + if (__USE_DEVTOOLS__ && IS_CLIENT) { const extensions = scope.run(() => extender({ store: store as Store, diff --git a/packages/pinia/src/vue2-plugin.ts b/packages/pinia/src/vue2-plugin.ts index 03647fd6..fbb9aad2 100644 --- a/packages/pinia/src/vue2-plugin.ts +++ b/packages/pinia/src/vue2-plugin.ts @@ -1,6 +1,6 @@ import type { Plugin } from 'vue-demi' import { registerPiniaDevtools } from './devtools' -import { IS_CLIENT, USE_DEVTOOLS } from './env' +import { IS_CLIENT } from './env' import { Pinia, piniaSymbol, setActivePinia } from './rootStore' /** @@ -57,7 +57,7 @@ export const PiniaVuePlugin: Plugin = function (_Vue) { // installing pinia's plugin setActivePinia(pinia) } - if (USE_DEVTOOLS) { + if (__USE_DEVTOOLS__ && IS_CLIENT) { registerPiniaDevtools(pinia._a, pinia) } } else if (!this.$pinia && options.parent && options.parent.$pinia) { diff --git a/packages/size-check/package.json b/packages/size-check/package.json index dea6c673..b0f85a75 100644 --- a/packages/size-check/package.json +++ b/packages/size-check/package.json @@ -1,6 +1,7 @@ { "name": "@pinia/size-check", "private": true, + "type": "module", "description": "size checks", "version": "0.0.0", "scripts": { @@ -13,6 +14,6 @@ "zlib": "^1.0.5" }, "dependencies": { - "pinia": "workspace:^2.0.18" + "pinia": "workspace:*" } } diff --git a/packages/size-check/rollup.config.mjs b/packages/size-check/rollup.config.mjs index 2096ca6a..fff4af6b 100644 --- a/packages/size-check/rollup.config.mjs +++ b/packages/size-check/rollup.config.mjs @@ -5,6 +5,7 @@ import replace from '@rollup/plugin-replace' import nodeResolve from '@rollup/plugin-node-resolve' import commonjs from '@rollup/plugin-commonjs' import terser from '@rollup/plugin-terser' +import alias from '@rollup/plugin-alias' const __filename = fileURLToPath(import.meta.url) const __dirname = dirname(__filename) @@ -21,13 +22,22 @@ export default config */ function createConfig(file) { return { - external: ['vue'], + external: [ + 'vue', + // this is left to test things + // '@vue/devtools-api' + ], output: { file: resolve(__dirname, `./dist/${file}.js`), - format: 'es', + format: 'esm', }, input: resolve(__dirname, `./src/${file}.js`), plugins: [ + alias({ + entries: { + pinia: resolve(__dirname, '../pinia/dist/pinia.mjs'), + }, + }), replace({ preventAssignment: true, values: { @@ -66,7 +76,7 @@ function createConfig(file) { }, module: true, compress: { - ecma: 2015, + ecma: 2019, pure_getters: true, }, }), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0f62c3b5..9b395e9e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -121,12 +121,12 @@ importers: version: link:../pinia vitepress: specifier: 1.0.0-rc.24 - version: 1.0.0-rc.24(@algolia/client-search@4.20.0)(@types/node@20.8.9)(search-insights@2.9.0)(typescript@5.2.2) + version: 1.0.0-rc.24(@algolia/client-search@4.20.0)(@types/node@20.8.10)(search-insights@2.9.0)(typescript@5.2.2) packages/nuxt: dependencies: '@nuxt/kit': - specifier: ^3.8.0 + specifier: ^3.4.3 version: 3.8.0(rollup@3.29.4) pinia: specifier: '>=2.1.7' @@ -183,7 +183,7 @@ importers: dependencies: '@vue/composition-api': specifier: ^1.4.0 - version: 1.4.0(vue@3.3.4) + version: 1.4.0(vue@3.3.7) '@vue/devtools-api': specifier: ^6.5.1 version: 6.5.1 @@ -192,10 +192,10 @@ importers: version: 4.9.4 vue: specifier: ^2.6.14 || ^3.3.0 - version: 3.3.7(typescript@5.2.2) + version: 3.3.7(typescript@4.9.4) vue-demi: specifier: '>=0.14.6' - version: 0.14.6(vue@3.3.7) + version: 0.14.6(@vue/composition-api@1.4.0)(vue@3.3.7) devDependencies: '@microsoft/api-extractor': specifier: 7.38.1 @@ -230,12 +230,12 @@ importers: version: 4.4.0(vite@4.5.0)(vue@3.3.7) vite: specifier: ^4.5.0 - version: 4.5.0(@types/node@20.8.9) + version: 4.5.0(@types/node@20.8.10) packages/size-check: dependencies: pinia: - specifier: workspace:^2.0.18 + specifier: workspace:* version: link:../pinia devDependencies: brotli-wasm: @@ -249,7 +249,7 @@ importers: dependencies: vue-demi: specifier: '>=0.14.6' - version: 0.14.6(@vue/composition-api@1.4.0)(vue@3.3.4) + version: 0.14.6(vue@3.3.7) devDependencies: pinia: specifier: workspace:^2.0.18 @@ -2358,12 +2358,6 @@ packages: resolution: {integrity: sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==} dependencies: undici-types: 5.26.5 - dev: true - - /@types/node@20.8.9: - resolution: {integrity: sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==} - dependencies: - undici-types: 5.26.5 /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} @@ -2460,7 +2454,7 @@ packages: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.5.0(@types/node@20.8.9) + vite: 4.5.0(@types/node@20.8.10) vue: 3.3.7(typescript@5.2.2) dev: false @@ -2596,15 +2590,6 @@ packages: - supports-color dev: true - /@vue/compiler-core@3.3.4: - resolution: {integrity: sha512-cquyDNvZ6jTbf/+x+AgM2Arrp6G4Dzbb0R64jiG804HRMfRiFXWI6kqUVqZ6ZR0bQhIoQjB4+2bhNtVwndW15g==} - dependencies: - '@babel/parser': 7.23.0 - '@vue/shared': 3.3.4 - estree-walker: 2.0.2 - source-map-js: 1.0.2 - dev: false - /@vue/compiler-core@3.3.7: resolution: {integrity: sha512-pACdY6YnTNVLXsB86YD8OF9ihwpolzhhtdLVHhBL6do/ykr6kKXNYABRtNMGrsQXpEXXyAdwvWWkuTbs4MFtPQ==} dependencies: @@ -2613,34 +2598,12 @@ packages: estree-walker: 2.0.2 source-map-js: 1.0.2 - /@vue/compiler-dom@3.3.4: - resolution: {integrity: sha512-wyM+OjOVpuUukIq6p5+nwHYtj9cFroz9cwkfmP9O1nzH68BenTTv0u7/ndggT8cIQlnBeOo6sUT/gvHcIkLA5w==} - dependencies: - '@vue/compiler-core': 3.3.4 - '@vue/shared': 3.3.4 - dev: false - /@vue/compiler-dom@3.3.7: resolution: {integrity: sha512-0LwkyJjnUPssXv/d1vNJ0PKfBlDoQs7n81CbO6Q0zdL7H1EzqYRrTVXDqdBVqro0aJjo/FOa1qBAPVI4PGSHBw==} dependencies: '@vue/compiler-core': 3.3.7 '@vue/shared': 3.3.7 - /@vue/compiler-sfc@3.3.4: - resolution: {integrity: sha512-6y/d8uw+5TkCuzBkgLS0v3lSM3hJDntFEiUORM11pQ/hKvkhSKZrXW6i69UyXlJQisJxuUEJKAWEqWbWsLeNKQ==} - dependencies: - '@babel/parser': 7.23.0 - '@vue/compiler-core': 3.3.4 - '@vue/compiler-dom': 3.3.4 - '@vue/compiler-ssr': 3.3.4 - '@vue/reactivity-transform': 3.3.4 - '@vue/shared': 3.3.4 - estree-walker: 2.0.2 - magic-string: 0.30.5 - postcss: 8.4.31 - source-map-js: 1.0.2 - dev: false - /@vue/compiler-sfc@3.3.7: resolution: {integrity: sha512-7pfldWy/J75U/ZyYIXRVqvLRw3vmfxDo2YLMwVtWVNew8Sm8d6wodM+OYFq4ll/UxfqVr0XKiVwti32PCrruAw==} dependencies: @@ -2655,26 +2618,19 @@ packages: postcss: 8.4.31 source-map-js: 1.0.2 - /@vue/compiler-ssr@3.3.4: - resolution: {integrity: sha512-m0v6oKpup2nMSehwA6Uuu+j+wEwcy7QmwMkVNVfrV9P2qE5KshC6RwOCq8fjGS/Eak/uNb8AaWekfiXxbBB6gQ==} - dependencies: - '@vue/compiler-dom': 3.3.4 - '@vue/shared': 3.3.4 - dev: false - /@vue/compiler-ssr@3.3.7: resolution: {integrity: sha512-TxOfNVVeH3zgBc82kcUv+emNHo+vKnlRrkv8YvQU5+Y5LJGJwSNzcmLUoxD/dNzv0bhQ/F0s+InlgV0NrApJZg==} dependencies: '@vue/compiler-dom': 3.3.7 '@vue/shared': 3.3.7 - /@vue/composition-api@1.4.0(vue@3.3.4): + /@vue/composition-api@1.4.0(vue@3.3.7): resolution: {integrity: sha512-fanqJw1cqhkfS1dcpFY52CeR0aWDBr7ub/0ObPWqMnNPdRsMi1gX04Q3aLeRtJEuVeCFewNbqvkPskkSPTVaXQ==} peerDependencies: vue: '>= 2.5 < 3' dependencies: tslib: 2.4.1 - vue: 3.3.4 + vue: 3.3.7(typescript@4.9.4) dev: false /@vue/devtools-api@6.5.1: @@ -2699,16 +2655,6 @@ packages: vue-template-compiler: 2.7.15 dev: true - /@vue/reactivity-transform@3.3.4: - resolution: {integrity: sha512-MXgwjako4nu5WFLAjpBnCj/ieqcjE2aJBINUNQzkZQfzIZA4xn+0fV1tIYBJvvva3N3OvKGofRLvQIwEQPpaXw==} - dependencies: - '@babel/parser': 7.23.0 - '@vue/compiler-core': 3.3.4 - '@vue/shared': 3.3.4 - estree-walker: 2.0.2 - magic-string: 0.30.5 - dev: false - /@vue/reactivity-transform@3.3.7: resolution: {integrity: sha512-APhRmLVbgE1VPGtoLQoWBJEaQk4V8JUsqrQihImVqKT+8U6Qi3t5ATcg4Y9wGAPb3kIhetpufyZ1RhwbZCIdDA==} dependencies: @@ -2718,12 +2664,6 @@ packages: estree-walker: 2.0.2 magic-string: 0.30.5 - /@vue/reactivity@3.3.4: - resolution: {integrity: sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==} - dependencies: - '@vue/shared': 3.3.4 - dev: false - /@vue/reactivity@3.3.7: resolution: {integrity: sha512-cZNVjWiw00708WqT0zRpyAgduG79dScKEPYJXq2xj/aMtk3SKvL3FBt2QKUlh6EHBJ1m8RhBY+ikBUzwc7/khg==} dependencies: @@ -2733,27 +2673,12 @@ packages: resolution: {integrity: sha512-Ju7ndfKF02eyLMe/9FAWyvtWwarcLK8+A9DBBSGIIdysiCw5CBLKfPE+amUyaSV0riZZtxREQVEOKLh81xDb8g==} dev: false - /@vue/runtime-core@3.3.4: - resolution: {integrity: sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==} - dependencies: - '@vue/reactivity': 3.3.4 - '@vue/shared': 3.3.4 - dev: false - /@vue/runtime-core@3.3.7: resolution: {integrity: sha512-LHq9du3ubLZFdK/BP0Ysy3zhHqRfBn80Uc+T5Hz3maFJBGhci1MafccnL3rpd5/3wVfRHAe6c+PnlO2PAavPTQ==} dependencies: '@vue/reactivity': 3.3.7 '@vue/shared': 3.3.7 - /@vue/runtime-dom@3.3.4: - resolution: {integrity: sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==} - dependencies: - '@vue/runtime-core': 3.3.4 - '@vue/shared': 3.3.4 - csstype: 3.1.2 - dev: false - /@vue/runtime-dom@3.3.7: resolution: {integrity: sha512-PFQU1oeJxikdDmrfoNQay5nD4tcPNYixUBruZzVX/l0eyZvFKElZUjW4KctCcs52nnpMGO6UDK+jF5oV4GT5Lw==} dependencies: @@ -2761,16 +2686,6 @@ packages: '@vue/shared': 3.3.7 csstype: 3.1.2 - /@vue/server-renderer@3.3.4(vue@3.3.4): - resolution: {integrity: sha512-Q6jDDzR23ViIb67v+vM1Dqntu+HUexQcsWKhhQa4ARVzxOY2HbC7QRW/ggkDBd5BU+uM1sV6XOAP0b216o34JQ==} - peerDependencies: - vue: 3.3.4 - dependencies: - '@vue/compiler-ssr': 3.3.4 - '@vue/shared': 3.3.4 - vue: 3.3.4 - dev: false - /@vue/server-renderer@3.3.7(vue@3.3.7): resolution: {integrity: sha512-UlpKDInd1hIZiNuVVVvLgxpfnSouxKQOSE2bOfQpBuGwxRV/JqqTCyyjXUWiwtVMyeRaZhOYYqntxElk8FhBhw==} peerDependencies: @@ -2780,10 +2695,6 @@ packages: '@vue/shared': 3.3.7 vue: 3.3.7(typescript@5.2.2) - /@vue/shared@3.3.4: - resolution: {integrity: sha512-7OjdcV8vQ74eiz1TZLzZP4JwqM5fA94K6yntPS5Z25r9HDuGNzaGdgvwKYq6S+MxwF0TFRwe50fIR/MYnakdkQ==} - dev: false - /@vue/shared@3.3.7: resolution: {integrity: sha512-N/tbkINRUDExgcPTBvxNkvHGu504k8lzlNQRITVnm6YjOjwa4r0nnbd4Jb01sNpur5hAllyRJzSK5PvB9PPwRg==} @@ -2798,7 +2709,7 @@ packages: dependencies: '@vue/server-renderer': 3.3.7(vue@3.3.7) js-beautify: 1.14.9 - vue: 3.3.7(typescript@5.2.2) + vue: 3.3.7(typescript@4.9.4) vue-component-type-helpers: 1.8.4 dev: true @@ -8172,7 +8083,6 @@ packages: resolution: {integrity: sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==} engines: {node: '>=4.2.0'} hasBin: true - dev: false /typescript@5.0.4: resolution: {integrity: sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==} @@ -8673,44 +8583,8 @@ packages: rollup: 3.29.4 optionalDependencies: fsevents: 2.3.3 - dev: true - /vite@4.5.0(@types/node@20.8.9): - resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} - engines: {node: ^14.18.0 || >=16.0.0} - hasBin: true - peerDependencies: - '@types/node': '>= 14' - less: '*' - lightningcss: ^1.21.0 - sass: '*' - stylus: '*' - sugarss: '*' - terser: ^5.4.0 - peerDependenciesMeta: - '@types/node': - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - dependencies: - '@types/node': 20.8.9 - esbuild: 0.18.20 - postcss: 8.4.31 - rollup: 3.29.4 - optionalDependencies: - fsevents: 2.3.3 - - /vitepress@1.0.0-rc.24(@algolia/client-search@4.20.0)(@types/node@20.8.9)(search-insights@2.9.0)(typescript@5.2.2): + /vitepress@1.0.0-rc.24(@algolia/client-search@4.20.0)(@types/node@20.8.10)(search-insights@2.9.0)(typescript@5.2.2): resolution: {integrity: sha512-RpnL8cnOGwiRlBbrYQUm9sYkJbtyOt/wYXk2diTcokY4yvks/5lq9LuSt+MURWB6ZqwpSNHvTmxgaSfLoG0/OA==} hasBin: true peerDependencies: @@ -8733,7 +8607,7 @@ packages: mark.js: 8.11.1 minisearch: 6.2.0 shiki: 0.14.5 - vite: 4.5.0(@types/node@20.8.9) + vite: 4.5.0(@types/node@20.8.10) vue: 3.3.7(typescript@5.2.2) transitivePeerDependencies: - '@algolia/client-search' @@ -8885,7 +8759,7 @@ packages: resolution: {integrity: sha512-6bnLkn8O0JJyiFSIF0EfCogzeqNXpnjJ0vW/SZzNHfe6sPx30lTtTXlE5TFs2qhJlAtDFybStVNpL73cPe3OMQ==} dev: true - /vue-demi@0.14.6(@vue/composition-api@1.4.0)(vue@3.3.4): + /vue-demi@0.14.6(@vue/composition-api@1.4.0)(vue@3.3.7): resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==} engines: {node: '>=12'} hasBin: true @@ -8897,8 +8771,8 @@ packages: '@vue/composition-api': optional: true dependencies: - '@vue/composition-api': 1.4.0(vue@3.3.4) - vue: 3.3.4 + '@vue/composition-api': 1.4.0(vue@3.3.7) + vue: 3.3.7(typescript@4.9.4) dev: false /vue-demi@0.14.6(vue@3.3.7): @@ -8960,15 +8834,20 @@ packages: typescript: 5.2.2 dev: true - /vue@3.3.4: - resolution: {integrity: sha512-VTyEYn3yvIeY1Py0WaYGZsXnz3y5UnGi62GjVEqvEGPl6nxbOrCXbVOTQWBEJUqAyTUk2uJ5JLVnYJ6ZzGbrSw==} + /vue@3.3.7(typescript@4.9.4): + resolution: {integrity: sha512-YEMDia1ZTv1TeBbnu6VybatmSteGOS3A3YgfINOfraCbf85wdKHzscD6HSS/vB4GAtI7sa1XPX7HcQaJ1l24zA==} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true dependencies: - '@vue/compiler-dom': 3.3.4 - '@vue/compiler-sfc': 3.3.4 - '@vue/runtime-dom': 3.3.4 - '@vue/server-renderer': 3.3.4(vue@3.3.4) - '@vue/shared': 3.3.4 - dev: false + '@vue/compiler-dom': 3.3.7 + '@vue/compiler-sfc': 3.3.7 + '@vue/runtime-dom': 3.3.7 + '@vue/server-renderer': 3.3.7(vue@3.3.7) + '@vue/shared': 3.3.7 + typescript: 4.9.4 /vue@3.3.7(typescript@5.2.2): resolution: {integrity: sha512-YEMDia1ZTv1TeBbnu6VybatmSteGOS3A3YgfINOfraCbf85wdKHzscD6HSS/vB4GAtI7sa1XPX7HcQaJ1l24zA==} diff --git a/rollup.config.mjs b/rollup.config.mjs index 6995565d..74019ed0 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -172,23 +172,29 @@ function createReplacePlugin( isGlobalBuild, isNodeBuild ) { + const __DEV__ = + (isBundlerESMBuild && !isRawESMBuild) || (isNodeBuild && !isProduction) + ? // preserve to be handled by bundlers + `(process.env.NODE_ENV !== 'production')` + : // hard coded dev/prod builds + JSON.stringify(!isProduction) + const __FEATURE_PROD_DEVTOOLS__ = isBundlerESMBuild + ? `(typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)` + : 'false' + + const __TEST__ = + (isBundlerESMBuild && !isRawESMBuild) || isNodeBuild + ? `(process.env.NODE_ENV === 'test')` + : 'false' + const replacements = { __COMMIT__: `"${process.env.COMMIT}"`, __VERSION__: `"${pkg.version}"`, - __DEV__: - (isBundlerESMBuild && !isRawESMBuild) || (isNodeBuild && !isProduction) - ? // preserve to be handled by bundlers - `(process.env.NODE_ENV !== 'production')` - : // hard coded dev/prod builds - JSON.stringify(!isProduction), + __USE_DEVTOOLS__: `((${__DEV__} || ${__FEATURE_PROD_DEVTOOLS__}) && !${__TEST__})`, + __DEV__, // this is only used during tests - __TEST__: - (isBundlerESMBuild && !isRawESMBuild) || isNodeBuild - ? `(process.env.NODE_ENV === 'test')` - : 'false', - __FEATURE_PROD_DEVTOOLS__: isBundlerESMBuild - ? `(typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)` - : 'false', + __TEST__, + __FEATURE_PROD_DEVTOOLS__, // If the build is expected to run directly in the browser (global / esm builds) __BROWSER__: JSON.stringify(isRawESMBuild), // is targeting bundlers?