From a5ed2c211dd901bd8c6256faf2051af6d1ad6458 Mon Sep 17 00:00:00 2001 From: driesvints Date: Tue, 21 May 2024 18:14:00 +0000 Subject: [PATCH 1/3] Update CHANGELOG --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f4e55..6d68e49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Release Notes -## [Unreleased](https://github.com/laravel/vite-plugin/compare/v1.0.3...1.x) +## [Unreleased](https://github.com/laravel/vite-plugin/compare/v1.0.4...1.x) + +## [v1.0.4](https://github.com/laravel/vite-plugin/compare/v1.0.3...v1.0.4) - 2024-05-17 + +* Include base in hotFile without modifying server.origin replacement by [@danielztolnai](https://github.com/danielztolnai) in https://github.com/laravel/vite-plugin/pull/296 ## [v1.0.3](https://github.com/laravel/vite-plugin/compare/v1.0.2...v1.0.3) - 2024-05-16 From 83e95a5b957ad5602d91e6a1b58a9609890e6790 Mon Sep 17 00:00:00 2001 From: Tyler Smith Date: Mon, 8 Jul 2024 16:42:19 -0700 Subject: [PATCH 2/3] Use Rollup InputOption for entrypoint types (#298) --- src/index.ts | 7 ++++--- tests/index.test.ts | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index d530fc5..75d8965 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,12 +6,13 @@ import path from 'path' import colors from 'picocolors' import { Plugin, loadEnv, UserConfig, ConfigEnv, ResolvedConfig, SSROptions, PluginOption } from 'vite' import fullReload, { Config as FullReloadConfig } from 'vite-plugin-full-reload' +import { InputOption } from "rollup" interface PluginConfig { /** * The path or paths of the entry points to compile. */ - input: string|string[] + input: InputOption /** * Laravel's public directory. @@ -37,7 +38,7 @@ interface PluginConfig { /** * The path of the SSR entry point. */ - ssr?: string|string[] + ssr?: InputOption /** * The directory where the SSR bundle should be written. @@ -368,7 +369,7 @@ function resolveBase(config: Required, assetUrl: string): string { /** * Resolve the Vite input path from the configuration. */ -function resolveInput(config: Required, ssr: boolean): string|string[]|undefined { +function resolveInput(config: Required, ssr: boolean): InputOption|undefined { if (ssr) { return config.ssr } diff --git a/tests/index.test.ts b/tests/index.test.ts index f4bf776..5b602b5 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -81,6 +81,45 @@ describe('laravel-vite-plugin', () => { expect(ssrConfig.build.rollupOptions.input).toBe('resources/js/ssr.ts') }) + it('accepts a single input within a full configuration', () => { + const plugin = laravel({ + input: 'resources/js/app.ts', + ssr: 'resources/js/ssr.ts', + })[0] + + const config = plugin.config({}, { command: 'build', mode: 'production' }) + expect(config.build.rollupOptions.input).toBe('resources/js/app.ts') + + const ssrConfig = plugin.config({ build: { ssr: true } }, { command: 'build', mode: 'production' }) + expect(ssrConfig.build.rollupOptions.input).toBe('resources/js/ssr.ts') + }) + + it('accepts an array of inputs within a full configuration', () => { + const plugin = laravel({ + input: ['resources/js/app.ts', 'resources/js/other.js'], + ssr: ['resources/js/ssr.ts', 'resources/js/other.js'], + })[0] + + const config = plugin.config({}, { command: 'build', mode: 'production' }) + expect(config.build.rollupOptions.input).toEqual(['resources/js/app.ts', 'resources/js/other.js']) + + const ssrConfig = plugin.config({ build: { ssr: true } }, { command: 'build', mode: 'production' }) + expect(ssrConfig.build.rollupOptions.input).toEqual(['resources/js/ssr.ts', 'resources/js/other.js']) + }) + + it('accepts an input object within a full configuration', () => { + const plugin = laravel({ + input: { app: 'resources/js/entrypoint-browser.js' }, + ssr: { ssr: 'resources/js/entrypoint-ssr.js' }, + })[0] + + const config = plugin.config({}, { command: 'build', mode: 'production' }) + expect(config.build.rollupOptions.input).toEqual({ app: 'resources/js/entrypoint-browser.js' }) + + const ssrConfig = plugin.config({ build: { ssr: true } }, { command: 'build', mode: 'production' }) + expect(ssrConfig.build.rollupOptions.input).toEqual({ ssr: 'resources/js/entrypoint-ssr.js' }) + }) + it('respects the users build.manifest config option', () => { const plugin = laravel({ input: 'resources/js/app.js', From 91491adffa1437fdf40b9e843804d2d9b2e54ef0 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 9 Jul 2024 12:31:52 -0500 Subject: [PATCH 3/3] 1.0.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 15fd7fa..8d65c5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "laravel-vite-plugin", - "version": "1.0.4", + "version": "1.0.5", "description": "Laravel plugin for Vite.", "keywords": [ "laravel",