From b0f9c799f47ac4c42df7602c0220d0d62aef879e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 21 Apr 2024 16:34:01 +0000 Subject: [PATCH 1/2] chore(deps): Bump vite-plugin-css-injected-by-js from 3.3.1 to 3.5.0 Bumps [vite-plugin-css-injected-by-js](https://github.com/marco-prontera/vite-plugin-css-injected-by-js) from 3.3.1 to 3.5.0. - [Release notes](https://github.com/marco-prontera/vite-plugin-css-injected-by-js/releases) - [Commits](https://github.com/marco-prontera/vite-plugin-css-injected-by-js/compare/v3.3.1...v3.5.0) --- updated-dependencies: - dependency-name: vite-plugin-css-injected-by-js dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package-lock.json | 8 ++++---- package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6c4ba4c..e25444e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "rollup-plugin-esbuild-minify": "^1.1.1", "rollup-plugin-license": "^3.3.1", "rollup-plugin-node-externals": "^7.1.1", - "vite-plugin-css-injected-by-js": "^3.3.1", + "vite-plugin-css-injected-by-js": "^3.5.0", "vite-plugin-dts": "^3.8.3", "vite-plugin-node-polyfills": "^0.21.0" }, @@ -6825,9 +6825,9 @@ } }, "node_modules/vite-plugin-css-injected-by-js": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.3.1.tgz", - "integrity": "sha512-PjM/X45DR3/V1K1fTRs8HtZHEQ55kIfdrn+dzaqNBFrOYO073SeSNCxp4j7gSYhV9NffVHaEnOL4myoko0ePAg==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/vite-plugin-css-injected-by-js/-/vite-plugin-css-injected-by-js-3.5.0.tgz", + "integrity": "sha512-d0QaHH9kS93J25SwRqJNEfE29PSuQS5jn51y9N9i2Yoq0FRO7rjuTeLvjM5zwklZlRrIn6SUdtOEDKyHokgJZg==", "peerDependencies": { "vite": ">2.0.0-0" } diff --git a/package.json b/package.json index 95da398..7f4923e 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "rollup-plugin-esbuild-minify": "^1.1.1", "rollup-plugin-license": "^3.3.1", "rollup-plugin-node-externals": "^7.1.1", - "vite-plugin-css-injected-by-js": "^3.3.1", + "vite-plugin-css-injected-by-js": "^3.5.0", "vite-plugin-dts": "^3.8.3", "vite-plugin-node-polyfills": "^0.21.0" }, From 0ea9cec56a852363ee48959fd9515494f9ebe4b2 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 21 Apr 2024 18:44:05 +0200 Subject: [PATCH 2/2] fix(app): Adjust inject-css plugin code for changed plugin Signed-off-by: Ferdinand Thiessen --- __tests__/appconfig.spec.ts | 2 +- lib/appConfig.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/__tests__/appconfig.spec.ts b/__tests__/appconfig.spec.ts index 14f40a5..7e56e3d 100644 --- a/__tests__/appconfig.spec.ts +++ b/__tests__/appconfig.spec.ts @@ -79,7 +79,7 @@ describe('app config', () => { }) describe('inlining css', () => { - const pluginName = cssInjectedByJsPlugin().name + const pluginName = [cssInjectedByJsPlugin()].flat()[0].name it('does not inline css by default', async () => { const resolved = await createConfig() diff --git a/lib/appConfig.ts b/lib/appConfig.ts index 21bab61..05352be 100644 --- a/lib/appConfig.ts +++ b/lib/appConfig.ts @@ -4,7 +4,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import type { UserConfig, UserConfigFn } from 'vite' +import type { Plugin, UserConfig, UserConfigFn } from 'vite' import type { BaseOptions, NodePolyfillsOptions } from './baseConfig.js' import { relative } from 'node:path' @@ -83,10 +83,16 @@ export const createAppConfig = (entries: { [entryAlias: string]: string }, optio // Make sure we get a user config and not a promise or a user config function const userConfig = await Promise.resolve(typeof options.config === 'function' ? options.config(env) : options.config) - const plugins = [] + const plugins = [] as Plugin[] // Inject all imported styles into the javascript bundle by creating dynamic styles on the document if (options.inlineCSS) { - plugins.push(injectCSSPlugin(typeof options.inlineCSS === 'object' ? options.inlineCSS : undefined)) + const plugin = injectCSSPlugin({ + dev: { + enableDev: env.mode === 'development', + }, + ...(typeof options.inlineCSS === 'object' ? options.inlineCSS : {}), + }) + plugins.push(...[plugin].flat()) } // defaults to true so only not adding if explicitly set to false