🔧 npm update

This commit is contained in:
2025-04-15 20:50:11 +02:00
parent ce5b9ac0c8
commit 94a90edabd
828 changed files with 256807 additions and 197099 deletions

0
node_modules/laravel-vite-plugin/bin/clean.js generated vendored Normal file → Executable file
View File

View File

@@ -1,10 +1,11 @@
import { Plugin, UserConfig, ConfigEnv } from 'vite';
import { 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.
*
@@ -26,7 +27,7 @@ interface PluginConfig {
/**
* The path of the SSR entry point.
*/
ssr?: string | string[];
ssr?: InputOption;
/**
* The directory where the SSR bundle should be written.
*

View File

@@ -13,7 +13,7 @@ const refreshPaths = [
"resources/lang/**",
"resources/views/**",
"routes/**"
];
].filter((path2) => fs.existsSync(path2.replace(/\*\*$/, "")));
function laravel(config) {
const pluginConfig = resolvePluginConfig(config);
return [
@@ -51,7 +51,14 @@ function resolveLaravelPlugin(pluginConfig) {
assetsInlineLimit: userConfig.build?.assetsInlineLimit ?? 0
},
server: {
origin: userConfig.server?.origin ?? "__laravel_vite_placeholder__",
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] : [],
/^https?:\/\/.*\.test(:\d+)?$/
]
},
...process.env.LARAVEL_SAIL ? {
host: userConfig.server?.host ?? "0.0.0.0",
port: userConfig.server?.port ?? (env.VITE_PORT ? parseInt(env.VITE_PORT) : 5173),
@@ -88,7 +95,7 @@ function resolveLaravelPlugin(pluginConfig) {
},
transform(code) {
if (resolvedConfig.command === "serve") {
code = code.replace(/__laravel_vite_placeholder__/g, viteDevServerUrl);
code = code.replace(/http:\/\/__laravel_vite_placeholder__\.test/g, viteDevServerUrl);
return pluginConfig.transformOnServe(code, viteDevServerUrl);
}
},
@@ -100,17 +107,17 @@ function resolveLaravelPlugin(pluginConfig) {
const isAddressInfo = (x) => typeof x === "object";
if (isAddressInfo(address)) {
viteDevServerUrl = userConfig.server?.origin ? userConfig.server.origin : resolveDevServerUrl(address, server.config, userConfig);
fs.writeFileSync(pluginConfig.hotFile, viteDevServerUrl);
fs.writeFileSync(pluginConfig.hotFile, `${viteDevServerUrl}${server.config.base.replace(/\/$/, "")}`);
setTimeout(() => {
server.config.logger.info(`
${colors.red(`${colors.bold("LARAVEL")} ${laravelVersion()}`)} ${colors.dim("plugin")} ${colors.bold(`v${pluginVersion()}`)}`);
server.config.logger.info("");
server.config.logger.info(` ${colors.green("\u279C")} ${colors.bold("APP_URL")}: ${colors.cyan(appUrl.replace(/:(\d+)/, (_, port) => `:${colors.bold(port)}`))}`);
if (typeof resolvedConfig.server.https === "object" && typeof resolvedConfig.server.https.key === "string") {
if (resolvedConfig.server.https.key.startsWith(herdConfigPath())) {
if (resolvedConfig.server.https.key.startsWith(herdMacConfigPath()) || resolvedConfig.server.https.key.startsWith(herdWindowsConfigPath())) {
server.config.logger.info(` ${colors.green("\u279C")} Using Herd certificate to secure Vite.`);
}
if (resolvedConfig.server.https.key.startsWith(valetConfigPath())) {
if (resolvedConfig.server.https.key.startsWith(valetMacConfigPath()) || resolvedConfig.server.https.key.startsWith(valetLinuxConfigPath())) {
server.config.logger.info(` ${colors.green("\u279C")} Using Valet certificate to secure Vite.`);
}
}
@@ -324,7 +331,7 @@ function resolveDevelopmentEnvironmentServerConfig(host) {
if (host === null) {
return;
}
if (configPath === herdConfigPath()) {
if (configPath === herdMacConfigPath() || configPath === herdWindowsConfigPath()) {
throw Error(`Unable to find certificate files for your host [${resolvedHost}] in the [${configPath}/Certificates] directory. Ensure you have secured the site via the Herd UI.`);
} else if (typeof host === "string") {
throw Error(`Unable to find certificate files for your host [${resolvedHost}] in the [${configPath}/Certificates] directory. Ensure you have secured the site by running \`valet secure ${host}\`.`);
@@ -342,11 +349,17 @@ function resolveDevelopmentEnvironmentServerConfig(host) {
};
}
function determineDevelopmentEnvironmentConfigPath() {
if (fs.existsSync(herdConfigPath())) {
return herdConfigPath();
if (fs.existsSync(herdMacConfigPath())) {
return herdMacConfigPath();
}
if (fs.existsSync(valetConfigPath())) {
return valetConfigPath();
if (fs.existsSync(herdWindowsConfigPath())) {
return herdWindowsConfigPath();
}
if (fs.existsSync(valetMacConfigPath())) {
return valetMacConfigPath();
}
if (fs.existsSync(valetLinuxConfigPath())) {
return valetLinuxConfigPath();
}
}
function resolveDevelopmentEnvironmentTld(configPath) {
@@ -360,12 +373,18 @@ function resolveDevelopmentEnvironmentTld(configPath) {
function dirname() {
return fileURLToPath(new URL(".", import.meta.url));
}
function herdConfigPath() {
function herdMacConfigPath() {
return path.resolve(os.homedir(), "Library", "Application Support", "Herd", "config", "valet");
}
function valetConfigPath() {
function herdWindowsConfigPath() {
return path.resolve(os.homedir(), ".config", "herd", "config", "valet");
}
function valetMacConfigPath() {
return path.resolve(os.homedir(), ".config", "valet");
}
function valetLinuxConfigPath() {
return path.resolve(os.homedir(), ".valet");
}
export {
laravel as default,
refreshPaths

View File

@@ -1,6 +1,6 @@
{
"name": "laravel-vite-plugin",
"version": "1.0.1",
"version": "1.2.0",
"description": "Laravel plugin for Vite.",
"keywords": [
"laravel",
@@ -49,14 +49,14 @@
"esbuild": "0.16.10",
"eslint": "^8.14.0",
"typescript": "^4.6.4",
"vite": "^5.0.0",
"vite": "^6.0.0",
"vitest": "^0.34.4"
},
"peerDependencies": {
"vite": "^5.0.0"
"vite": "^5.0.0 || ^6.0.0"
},
"engines": {
"node": "^18.0.0 || >=20.0.0"
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
},
"dependencies": {
"picocolors": "^1.0.0",