diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 1625bda..ebda620 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -4,6 +4,10 @@ on: release: types: [released] +permissions: {} + jobs: update: + permissions: + contents: write uses: laravel/.github/.github/workflows/update-changelog.yml@main diff --git a/CHANGELOG.md b/CHANGELOG.md index 187f216..b350a66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Release Notes -## [Unreleased](https://github.com/laravel/vite-plugin/compare/v1.1.1...1.x) +## [Unreleased](https://github.com/laravel/vite-plugin/compare/v1.2.0...1.x) + +## [v1.2.0](https://github.com/laravel/vite-plugin/compare/v1.1.1...v1.2.0) - 2025-01-21 + +* [1.x] Fix Invalid URL issue with Vite 6.0.9 by [@batinmustu](https://github.com/batinmustu) in https://github.com/laravel/vite-plugin/pull/317 +* [1.x] Add default CORS origins by [@timacdonald](https://github.com/timacdonald) in https://github.com/laravel/vite-plugin/pull/318 ## [v1.1.1](https://github.com/laravel/vite-plugin/compare/v1.1.0...v1.1.1) - 2024-12-03 diff --git a/package.json b/package.json index aaeadba..a05fea8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "laravel-vite-plugin", - "version": "1.2.0", + "version": "1.3.0", "description": "Laravel plugin for Vite.", "keywords": [ "laravel", diff --git a/src/index.ts b/src/index.ts index c0daeeb..ee45b92 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,15 +4,14 @@ import os from 'os' import { fileURLToPath } from 'url' import path from 'path' import colors from 'picocolors' -import { Plugin, loadEnv, UserConfig, ConfigEnv, ResolvedConfig, SSROptions, PluginOption } from 'vite' +import { Plugin, loadEnv, UserConfig, ConfigEnv, ResolvedConfig, SSROptions, PluginOption, Rollup } 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: InputOption + input: Rollup.InputOption /** * Laravel's public directory. @@ -38,7 +37,7 @@ interface PluginConfig { /** * The path of the SSR entry point. */ - ssr?: InputOption + ssr?: Rollup.InputOption /** * The directory where the SSR bundle should be written. @@ -154,9 +153,9 @@ function resolveLaravelPlugin(pluginConfig: Required): LaravelPlug origin: userConfig.server?.origin ?? 'http://__laravel_vite_placeholder__.test', cors: userConfig.server?.cors ?? { origin: userConfig.server?.origin ?? [ - /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, - ...(env.APP_URL ? [env.APP_URL] : []), // * (APP_URL="http://my-app.tld") - /^https?:\/\/.*\.test(:\d+)?$/, // Valet / Herd (SCHEME://*.test:PORT) + /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, // Copied from Vite itself. We can import this once we drop 5.0 support and require Vite 6.1+. Source: https://github.com/vitejs/vite/blob/0c854645bd17960abbe8f01b602d1a1da1a2b9fd/packages/vite/src/node/constants.ts#L200-L201 + ...(env.APP_URL ? [env.APP_URL] : []), // * (APP_URL="http://my-app.tld") + /^https?:\/\/.*\.test(:\d+)?$/, // Valet / Herd (SCHEME://*.test:PORT) ], }, ...(process.env.LARAVEL_SAIL ? { @@ -376,7 +375,7 @@ function resolveBase(config: Required, assetUrl: string): string { /** * Resolve the Vite input path from the configuration. */ -function resolveInput(config: Required, ssr: boolean): InputOption|undefined { +function resolveInput(config: Required, ssr: boolean): Rollup.InputOption|undefined { if (ssr) { return config.ssr }