@studiometa/foehn-vite-plugin 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +61 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ The plugin enables Vite's native manifest generation (`build.manifest: true`). T
|
|
|
54
54
|
|
|
55
55
|
### Hot Reload
|
|
56
56
|
|
|
57
|
-
During development, the plugin writes a `hot` file containing the dev server URL.
|
|
57
|
+
During development, the plugin writes a `hot` file inside `outDir` containing the dev server URL. It creates `outDir` when needed, so the dev server works before the first build. `ViteManifest::fromTheme()` reads the same file to detect dev mode and inject the Vite client script. If you change `hotFile`, pass the same name as the second argument of `fromTheme()`. The plugin removes the file when the dev server stops, also on Ctrl+C, and at the end of a build.
|
|
58
58
|
|
|
59
59
|
### File Watching
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ The plugin watches files matching the `reload` patterns and triggers a full page
|
|
|
62
62
|
|
|
63
63
|
### DDEV Integration
|
|
64
64
|
|
|
65
|
-
When a `.ddev/config.yaml` file is detected, the plugin
|
|
65
|
+
When a `.ddev/config.yaml` file is detected, the plugin proxies the dev server to the DDEV site. Vite keeps every request it can serve (its own `/@` routes, `/node_modules/`, the HMR connection and every file under the Vite root or the public directory) and sends the others, such as WordPress pages, to DDEV.
|
|
66
66
|
|
|
67
67
|
## Options
|
|
68
68
|
|
|
@@ -72,7 +72,7 @@ When a `.ddev/config.yaml` file is detected, the plugin automatically configures
|
|
|
72
72
|
| `reload` | `string \| string[]` | `["templates/**/*.twig"]` | Patterns to watch for full reload |
|
|
73
73
|
| `outDir` | `string` | `"dist"` | Output directory for built assets |
|
|
74
74
|
| `themeDir` | `string` | `process.cwd()` | Theme directory context |
|
|
75
|
-
| `hotFile` | `string` | `"hot"` | Name of the hot file
|
|
75
|
+
| `hotFile` | `string` | `"hot"` | Name of the hot file, in `outDir` |
|
|
76
76
|
|
|
77
77
|
## PHP Integration
|
|
78
78
|
|
|
@@ -90,6 +90,10 @@ public function enqueueAssets(): void
|
|
|
90
90
|
}
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
+
## AI agents
|
|
94
|
+
|
|
95
|
+
This package ships the `foehn-vite-plugin` [Agent Skill](https://agentskills.io/) in [`skills/foehn-vite-plugin/SKILL.md`](skills/foehn-vite-plugin/SKILL.md). See [AI Agents](https://studiometa.github.io/foehn-framework/guide/ai-agents) to install it.
|
|
96
|
+
|
|
93
97
|
## License
|
|
94
98
|
|
|
95
99
|
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,9 @@ export declare interface FoehnPluginOptions {
|
|
|
32
32
|
*/
|
|
33
33
|
themeDir?: string;
|
|
34
34
|
/**
|
|
35
|
-
* Name of the hot file generated during development
|
|
35
|
+
* Name of the hot file generated during development, written inside
|
|
36
|
+
* `outDir`. Pass the same name to `ViteManifest::fromTheme()` when you
|
|
37
|
+
* change it.
|
|
36
38
|
* @default "hot"
|
|
37
39
|
*/
|
|
38
40
|
hotFile?: string;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rmSync, statSync } from "node:fs";
|
|
2
|
+
import { constants } from "node:os";
|
|
3
|
+
import { dirname, join, relative, resolve } from "node:path";
|
|
2
4
|
import fastGlob from "fast-glob";
|
|
3
|
-
import {
|
|
5
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
6
|
//#region src/options.ts
|
|
5
7
|
/**
|
|
6
8
|
* Default values for optional options.
|
|
@@ -94,27 +96,31 @@ function getDdevSiteUrl(config) {
|
|
|
94
96
|
/**
|
|
95
97
|
* Write the hot file with the dev server URL.
|
|
96
98
|
* The PHP side reads this file to detect dev mode and inject the Vite client.
|
|
99
|
+
* The directory is created when it does not exist yet, so the dev server works
|
|
100
|
+
* before the first build.
|
|
97
101
|
*/
|
|
98
|
-
async function writeHotFile(
|
|
99
|
-
|
|
102
|
+
async function writeHotFile(hotPath, serverUrl) {
|
|
103
|
+
await mkdir(dirname(hotPath), { recursive: true });
|
|
100
104
|
await writeFile(hotPath, serverUrl, "utf-8");
|
|
101
105
|
}
|
|
102
106
|
/**
|
|
103
|
-
* Remove the hot file when the dev server stops.
|
|
107
|
+
* Remove the hot file when the dev server stops. Synchronous, so it is done
|
|
108
|
+
* before a process that is exiting goes away. A missing file is not an error.
|
|
104
109
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
await unlink(hotPath);
|
|
109
|
-
} catch {}
|
|
110
|
+
function removeHotFile(hotPath) {
|
|
111
|
+
rmSync(hotPath, { force: true });
|
|
110
112
|
}
|
|
111
113
|
//#endregion
|
|
112
114
|
//#region src/plugin.ts
|
|
115
|
+
/** Signals that end the process without Vite closing the server first. */
|
|
116
|
+
var EXIT_SIGNALS = ["SIGINT", "SIGHUP"];
|
|
113
117
|
/**
|
|
114
118
|
* Creates the Føhn Vite plugin.
|
|
115
119
|
*/
|
|
116
120
|
function foehn(options) {
|
|
117
121
|
const resolvedOptions = resolveOptions(options);
|
|
122
|
+
const outDir = resolve(resolvedOptions.themeDir, resolvedOptions.outDir);
|
|
123
|
+
const hotPath = resolve(outDir, resolvedOptions.hotFile);
|
|
118
124
|
let config;
|
|
119
125
|
return [{
|
|
120
126
|
name: "foehn",
|
|
@@ -126,31 +132,39 @@ function foehn(options) {
|
|
|
126
132
|
return {
|
|
127
133
|
build: {
|
|
128
134
|
manifest: true,
|
|
129
|
-
outDir
|
|
135
|
+
outDir,
|
|
130
136
|
rollupOptions: { input: entries }
|
|
131
137
|
},
|
|
132
|
-
server: proxyTarget ? { proxy: { "
|
|
138
|
+
server: proxyTarget ? { proxy: { "/": {
|
|
133
139
|
target: proxyTarget,
|
|
134
140
|
changeOrigin: true,
|
|
135
|
-
secure: false
|
|
141
|
+
secure: false,
|
|
142
|
+
bypass: (req) => isServedByVite(req, config) ? req.url : void 0
|
|
136
143
|
} } } : void 0
|
|
137
144
|
};
|
|
138
145
|
},
|
|
139
146
|
configResolved(resolvedConfig) {
|
|
140
147
|
config = resolvedConfig;
|
|
141
148
|
},
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
configureServer(server) {
|
|
150
|
+
const httpServer = server.httpServer;
|
|
151
|
+
if (!httpServer) return;
|
|
152
|
+
httpServer.once("listening", async () => {
|
|
153
|
+
const address = httpServer.address();
|
|
154
|
+
if (typeof address === "object" && address) await writeHotFile(hotPath, getServerUrl(address, config));
|
|
147
155
|
});
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
const onSignal = (signal) => {
|
|
157
|
+
removeHotFile(hotPath);
|
|
158
|
+
process.exit(128 + constants.signals[signal]);
|
|
159
|
+
};
|
|
160
|
+
for (const signal of EXIT_SIGNALS) process.on(signal, onSignal);
|
|
161
|
+
httpServer.on("close", () => {
|
|
162
|
+
removeHotFile(hotPath);
|
|
163
|
+
for (const signal of EXIT_SIGNALS) process.off(signal, onSignal);
|
|
150
164
|
});
|
|
151
165
|
},
|
|
152
|
-
|
|
153
|
-
if (config.command === "build")
|
|
166
|
+
buildEnd() {
|
|
167
|
+
if (config.command === "build") removeHotFile(hotPath);
|
|
154
168
|
}
|
|
155
169
|
}, createReloadPlugin(resolvedOptions)];
|
|
156
170
|
}
|
|
@@ -181,11 +195,32 @@ function matchPattern(file, pattern) {
|
|
|
181
195
|
return new RegExp(`^${regexPattern}$`).test(file);
|
|
182
196
|
}
|
|
183
197
|
/**
|
|
184
|
-
*
|
|
198
|
+
* Whether the dev server answers a request itself: its internal routes
|
|
199
|
+
* (`/@vite/client`, `/@fs/`, `/@id/`, `/__open-in-editor`), dependencies, the
|
|
200
|
+
* HMR ping, and every file under the root or the public directory, whatever
|
|
201
|
+
* the query (`?import`, `?direct`, `?v=`).
|
|
202
|
+
*/
|
|
203
|
+
function isServedByVite(req, config) {
|
|
204
|
+
if (req.headers.accept === "text/x-vite-ping") return true;
|
|
205
|
+
let path;
|
|
206
|
+
try {
|
|
207
|
+
path = decodeURIComponent((req.url ?? "/").split(/[?#]/)[0]);
|
|
208
|
+
} catch {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
if (path.startsWith("/@") || path.startsWith("/__") || path.startsWith("/node_modules/")) return true;
|
|
212
|
+
return [config.root, config.publicDir].some((dir) => dir !== "" && statSync(join(dir, path), { throwIfNoEntry: false })?.isFile());
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Get the URL a browser reaches the dev server at.
|
|
185
216
|
*/
|
|
186
|
-
function getServerUrl(
|
|
187
|
-
|
|
188
|
-
|
|
217
|
+
function getServerUrl(address, config) {
|
|
218
|
+
return `${config.server.https ? "https" : "http"}://${[
|
|
219
|
+
"::",
|
|
220
|
+
"0.0.0.0",
|
|
221
|
+
"::1",
|
|
222
|
+
"127.0.0.1"
|
|
223
|
+
].includes(address.address) ? "localhost" : address.family === "IPv6" ? `[${address.address}]` : address.address}:${address.port}`;
|
|
189
224
|
}
|
|
190
225
|
//#endregion
|
|
191
226
|
export { foehn as default, foehn };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/options.ts","../src/utils/glob.ts","../src/utils/ddev.ts","../src/utils/hot.ts","../src/plugin.ts"],"sourcesContent":["/**\n * Options for the Føhn Vite plugin.\n */\nexport interface FoehnPluginOptions {\n /**\n * Glob patterns for entry points.\n * @example [\"src/js/app.js\", \"src/css/app.css\"]\n */\n input: string | string[];\n\n /**\n * Files to watch for full reload.\n * @default [\"templates/**\\/*.twig\"]\n */\n reload?: string | string[];\n\n /**\n * Output directory for built assets.\n * @default \"dist\"\n */\n outDir?: string;\n\n /**\n * Theme directory context.\n * @default process.cwd()\n */\n themeDir?: string;\n\n /**\n * Name of the hot file generated during development.\n * @default \"hot\"\n */\n hotFile?: string;\n}\n\n/**\n * Resolved options with all defaults applied.\n */\nexport interface ResolvedFoehnPluginOptions {\n input: string[];\n reload: string[];\n outDir: string;\n themeDir: string;\n hotFile: string;\n}\n\n/**\n * Default values for optional options.\n */\nexport const defaultOptions: Omit<ResolvedFoehnPluginOptions, \"input\"> = {\n reload: [\"templates/**/*.twig\"],\n outDir: \"dist\",\n themeDir: process.cwd(),\n hotFile: \"hot\",\n};\n\n/**\n * Normalize and resolve plugin options.\n */\nexport function resolveOptions(options: FoehnPluginOptions): ResolvedFoehnPluginOptions {\n const input = Array.isArray(options.input) ? options.input : [options.input];\n\n const reload = options.reload\n ? Array.isArray(options.reload)\n ? options.reload\n : [options.reload]\n : defaultOptions.reload;\n\n return {\n input,\n reload,\n outDir: options.outDir ?? defaultOptions.outDir,\n themeDir: options.themeDir ?? defaultOptions.themeDir,\n hotFile: options.hotFile ?? defaultOptions.hotFile,\n };\n}\n","import fastGlob from \"fast-glob\";\nimport { resolve, relative } from \"node:path\";\n\n/**\n * Resolve glob patterns to absolute file paths.\n */\nexport async function resolveGlobPatterns(\n patterns: string[],\n cwd: string,\n): Promise<Record<string, string>> {\n const entries: Record<string, string> = {};\n\n for (const pattern of patterns) {\n // Check if pattern contains glob characters\n if (pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"{\")) {\n const files = await fastGlob(pattern, { cwd, absolute: true });\n for (const file of files) {\n const relativePath = relative(cwd, file);\n // Remove extension for entry name\n const name = relativePath.replace(/\\.[^/.]+$/, \"\");\n entries[name] = file;\n }\n } else {\n // Direct file path\n const absolutePath = resolve(cwd, pattern);\n const name = pattern.replace(/\\.[^/.]+$/, \"\");\n entries[name] = absolutePath;\n }\n }\n\n return entries;\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\n\n/**\n * DDEV project configuration structure.\n */\nexport interface DdevConfig {\n name: string;\n router_http_port?: string;\n router_https_port?: string;\n}\n\n/**\n * Detect DDEV configuration from the project root.\n * Returns null if no DDEV config is found.\n */\nexport async function detectDdev(projectRoot: string): Promise<DdevConfig | null> {\n const configPath = resolve(projectRoot, \".ddev/config.yaml\");\n\n try {\n const content = await readFile(configPath, \"utf-8\");\n return parseDdevConfig(content);\n } catch {\n return null;\n }\n}\n\n/**\n * Parse DDEV YAML config (simple parser, no dependency needed).\n */\nfunction parseDdevConfig(content: string): DdevConfig {\n const lines = content.split(\"\\n\");\n const config: Record<string, string> = {};\n\n for (const line of lines) {\n const match = line.match(/^(\\w+):\\s*(.+)$/);\n if (match) {\n const key = match[1];\n let value = match[2].trim();\n // Remove quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n config[key] = value;\n }\n }\n\n return {\n name: config.name ?? \"unknown\",\n router_http_port: config.router_http_port,\n router_https_port: config.router_https_port,\n };\n}\n\n/**\n * Get the DDEV site URL for proxy configuration.\n */\nexport function getDdevSiteUrl(config: DdevConfig): string {\n const port = config.router_https_port ?? \"443\";\n const portSuffix = port === \"443\" ? \"\" : `:${port}`;\n return `https://${config.name}.ddev.site${portSuffix}`;\n}\n","import { writeFile, unlink } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\n\n/**\n * Write the hot file with the dev server URL.\n * The PHP side reads this file to detect dev mode and inject the Vite client.\n */\nexport async function writeHotFile(\n themeDir: string,\n hotFileName: string,\n serverUrl: string,\n): Promise<void> {\n const hotPath = resolve(themeDir, hotFileName);\n await writeFile(hotPath, serverUrl, \"utf-8\");\n}\n\n/**\n * Remove the hot file when the dev server stops.\n */\nexport async function removeHotFile(themeDir: string, hotFileName: string): Promise<void> {\n const hotPath = resolve(themeDir, hotFileName);\n try {\n await unlink(hotPath);\n } catch {\n // File may not exist, ignore\n }\n}\n","import { resolve } from \"node:path\";\nimport type { Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport type { FoehnPluginOptions, ResolvedFoehnPluginOptions } from \"./options.js\";\nimport { resolveOptions } from \"./options.js\";\nimport {\n resolveGlobPatterns,\n detectDdev,\n getDdevSiteUrl,\n writeHotFile,\n removeHotFile,\n} from \"./utils/index.js\";\n\n/**\n * Creates the Føhn Vite plugin.\n */\nexport function foehn(options: FoehnPluginOptions): Plugin[] {\n const resolvedOptions = resolveOptions(options);\n let config: ResolvedConfig;\n\n const mainPlugin: Plugin = {\n name: \"foehn\",\n enforce: \"pre\",\n\n async config(_userConfig, { command: _command }) {\n const entries = await resolveGlobPatterns(\n resolvedOptions.input,\n resolvedOptions.themeDir,\n );\n\n // Detect DDEV for proxy configuration\n const ddevConfig = await detectDdev(resolvedOptions.themeDir);\n const proxyTarget = ddevConfig ? getDdevSiteUrl(ddevConfig) : undefined;\n\n return {\n build: {\n manifest: true,\n outDir: resolve(resolvedOptions.themeDir, resolvedOptions.outDir),\n rollupOptions: {\n input: entries,\n },\n },\n server: proxyTarget\n ? {\n proxy: {\n // Proxy all non-asset requests to DDEV\n \"^(?!/@|/node_modules|/src)\": {\n target: proxyTarget,\n changeOrigin: true,\n secure: false,\n },\n },\n }\n : undefined,\n };\n },\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n async configureServer(server: ViteDevServer) {\n const serverUrl = getServerUrl(server, config);\n\n // Write hot file when server starts\n server.httpServer?.once(\"listening\", async () => {\n const url = serverUrl ?? `http://localhost:${config.server.port}`;\n await writeHotFile(resolvedOptions.themeDir, resolvedOptions.hotFile, url);\n });\n\n // Remove hot file when server closes\n server.httpServer?.on(\"close\", async () => {\n await removeHotFile(resolvedOptions.themeDir, resolvedOptions.hotFile);\n });\n },\n\n async buildEnd() {\n // Ensure hot file is removed after build\n if (config.command === \"build\") {\n await removeHotFile(resolvedOptions.themeDir, resolvedOptions.hotFile);\n }\n },\n };\n\n // Separate plugin for file watching (full reload)\n const reloadPlugin = createReloadPlugin(resolvedOptions);\n\n return [mainPlugin, reloadPlugin];\n}\n\n/**\n * Creates a plugin that watches files for full reload.\n */\nfunction createReloadPlugin(options: ResolvedFoehnPluginOptions): Plugin {\n return {\n name: \"foehn:reload\",\n\n configureServer(server: ViteDevServer) {\n // Watch files for full reload\n for (const pattern of options.reload) {\n const fullPattern = resolve(options.themeDir, pattern);\n server.watcher.add(fullPattern);\n }\n\n server.watcher.on(\"change\", (file) => {\n // Check if the changed file matches any reload pattern\n const shouldReload = options.reload.some((pattern) => {\n const fullPattern = resolve(options.themeDir, pattern);\n return matchPattern(file, fullPattern);\n });\n\n if (shouldReload) {\n server.ws.send({ type: \"full-reload\" });\n }\n });\n },\n };\n}\n\n/**\n * Simple pattern matching for file paths.\n */\nfunction matchPattern(file: string, pattern: string): boolean {\n // Convert glob pattern to regex\n const regexPattern = pattern\n .replace(/\\*\\*/g, \"<<<GLOBSTAR>>>\")\n .replace(/\\*/g, \"[^/]*\")\n .replace(/<<<GLOBSTAR>>>/g, \".*\")\n .replace(/\\?/g, \".\");\n\n return new RegExp(`^${regexPattern}$`).test(file);\n}\n\n/**\n * Get the dev server URL.\n */\nfunction getServerUrl(server: ViteDevServer, config: ResolvedConfig): string | undefined {\n const address = server.httpServer?.address();\n if (typeof address === \"object\" && address) {\n const protocol = config.server.https ? \"https\" : \"http\";\n const host =\n address.address === \"::\" || address.address === \"0.0.0.0\"\n ? \"localhost\"\n : address.address;\n return `${protocol}://${host}:${address.port}`;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;AAiDA,IAAa,iBAA4D;CACrE,QAAQ,CAAC,qBAAqB;CAC9B,QAAQ;CACR,UAAU,QAAQ,IAAI;CACtB,SAAS;AACb;;;;AAKA,SAAgB,eAAe,SAAyD;CASpF,OAAO;EACH,OATU,MAAM,QAAQ,QAAQ,KAAK,IAAI,QAAQ,QAAQ,CAAC,QAAQ,KAAK;EAUvE,QARW,QAAQ,SACjB,MAAM,QAAQ,QAAQ,MAAM,IACxB,QAAQ,SACR,CAAC,QAAQ,MAAM,IACnB,eAAe;EAKjB,QAAQ,QAAQ,UAAU,eAA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","../src/utils/glob.ts","../src/utils/ddev.ts","../src/utils/hot.ts","../src/plugin.ts"],"sourcesContent":["/**\n * Options for the Føhn Vite plugin.\n */\nexport interface FoehnPluginOptions {\n /**\n * Glob patterns for entry points.\n * @example [\"src/js/app.js\", \"src/css/app.css\"]\n */\n input: string | string[];\n\n /**\n * Files to watch for full reload.\n * @default [\"templates/**\\/*.twig\"]\n */\n reload?: string | string[];\n\n /**\n * Output directory for built assets.\n * @default \"dist\"\n */\n outDir?: string;\n\n /**\n * Theme directory context.\n * @default process.cwd()\n */\n themeDir?: string;\n\n /**\n * Name of the hot file generated during development, written inside\n * `outDir`. Pass the same name to `ViteManifest::fromTheme()` when you\n * change it.\n * @default \"hot\"\n */\n hotFile?: string;\n}\n\n/**\n * Resolved options with all defaults applied.\n */\nexport interface ResolvedFoehnPluginOptions {\n input: string[];\n reload: string[];\n outDir: string;\n themeDir: string;\n hotFile: string;\n}\n\n/**\n * Default values for optional options.\n */\nexport const defaultOptions: Omit<ResolvedFoehnPluginOptions, \"input\"> = {\n reload: [\"templates/**/*.twig\"],\n outDir: \"dist\",\n themeDir: process.cwd(),\n hotFile: \"hot\",\n};\n\n/**\n * Normalize and resolve plugin options.\n */\nexport function resolveOptions(options: FoehnPluginOptions): ResolvedFoehnPluginOptions {\n const input = Array.isArray(options.input) ? options.input : [options.input];\n\n const reload = options.reload\n ? Array.isArray(options.reload)\n ? options.reload\n : [options.reload]\n : defaultOptions.reload;\n\n return {\n input,\n reload,\n outDir: options.outDir ?? defaultOptions.outDir,\n themeDir: options.themeDir ?? defaultOptions.themeDir,\n hotFile: options.hotFile ?? defaultOptions.hotFile,\n };\n}\n","import fastGlob from \"fast-glob\";\nimport { resolve, relative } from \"node:path\";\n\n/**\n * Resolve glob patterns to absolute file paths.\n */\nexport async function resolveGlobPatterns(\n patterns: string[],\n cwd: string,\n): Promise<Record<string, string>> {\n const entries: Record<string, string> = {};\n\n for (const pattern of patterns) {\n // Check if pattern contains glob characters\n if (pattern.includes(\"*\") || pattern.includes(\"?\") || pattern.includes(\"{\")) {\n const files = await fastGlob(pattern, { cwd, absolute: true });\n for (const file of files) {\n const relativePath = relative(cwd, file);\n // Remove extension for entry name\n const name = relativePath.replace(/\\.[^/.]+$/, \"\");\n entries[name] = file;\n }\n } else {\n // Direct file path\n const absolutePath = resolve(cwd, pattern);\n const name = pattern.replace(/\\.[^/.]+$/, \"\");\n entries[name] = absolutePath;\n }\n }\n\n return entries;\n}\n","import { readFile } from \"node:fs/promises\";\nimport { resolve } from \"node:path\";\n\n/**\n * DDEV project configuration structure.\n */\nexport interface DdevConfig {\n name: string;\n router_http_port?: string;\n router_https_port?: string;\n}\n\n/**\n * Detect DDEV configuration from the project root.\n * Returns null if no DDEV config is found.\n */\nexport async function detectDdev(projectRoot: string): Promise<DdevConfig | null> {\n const configPath = resolve(projectRoot, \".ddev/config.yaml\");\n\n try {\n const content = await readFile(configPath, \"utf-8\");\n return parseDdevConfig(content);\n } catch {\n return null;\n }\n}\n\n/**\n * Parse DDEV YAML config (simple parser, no dependency needed).\n */\nfunction parseDdevConfig(content: string): DdevConfig {\n const lines = content.split(\"\\n\");\n const config: Record<string, string> = {};\n\n for (const line of lines) {\n const match = line.match(/^(\\w+):\\s*(.+)$/);\n if (match) {\n const key = match[1];\n let value = match[2].trim();\n // Remove quotes if present\n if (\n (value.startsWith('\"') && value.endsWith('\"')) ||\n (value.startsWith(\"'\") && value.endsWith(\"'\"))\n ) {\n value = value.slice(1, -1);\n }\n config[key] = value;\n }\n }\n\n return {\n name: config.name ?? \"unknown\",\n router_http_port: config.router_http_port,\n router_https_port: config.router_https_port,\n };\n}\n\n/**\n * Get the DDEV site URL for proxy configuration.\n */\nexport function getDdevSiteUrl(config: DdevConfig): string {\n const port = config.router_https_port ?? \"443\";\n const portSuffix = port === \"443\" ? \"\" : `:${port}`;\n return `https://${config.name}.ddev.site${portSuffix}`;\n}\n","import { rmSync } from \"node:fs\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\nimport { dirname } from \"node:path\";\n\n/**\n * Write the hot file with the dev server URL.\n * The PHP side reads this file to detect dev mode and inject the Vite client.\n * The directory is created when it does not exist yet, so the dev server works\n * before the first build.\n */\nexport async function writeHotFile(hotPath: string, serverUrl: string): Promise<void> {\n await mkdir(dirname(hotPath), { recursive: true });\n await writeFile(hotPath, serverUrl, \"utf-8\");\n}\n\n/**\n * Remove the hot file when the dev server stops. Synchronous, so it is done\n * before a process that is exiting goes away. A missing file is not an error.\n */\nexport function removeHotFile(hotPath: string): void {\n rmSync(hotPath, { force: true });\n}\n","import { statSync } from \"node:fs\";\nimport type { IncomingMessage } from \"node:http\";\nimport type { AddressInfo } from \"node:net\";\nimport { constants } from \"node:os\";\nimport { join, resolve } from \"node:path\";\nimport type { Plugin, ResolvedConfig, ViteDevServer } from \"vite\";\nimport type { FoehnPluginOptions, ResolvedFoehnPluginOptions } from \"./options.js\";\nimport { resolveOptions } from \"./options.js\";\nimport {\n resolveGlobPatterns,\n detectDdev,\n getDdevSiteUrl,\n writeHotFile,\n removeHotFile,\n} from \"./utils/index.js\";\n\n/** Signals that end the process without Vite closing the server first. */\nconst EXIT_SIGNALS = [\"SIGINT\", \"SIGHUP\"] as const;\n\n/**\n * Creates the Føhn Vite plugin.\n */\nexport function foehn(options: FoehnPluginOptions): Plugin[] {\n const resolvedOptions = resolveOptions(options);\n const outDir = resolve(resolvedOptions.themeDir, resolvedOptions.outDir);\n // Inside the build output, where `ViteManifest` looks for it.\n const hotPath = resolve(outDir, resolvedOptions.hotFile);\n let config: ResolvedConfig;\n\n const mainPlugin: Plugin = {\n name: \"foehn\",\n enforce: \"pre\",\n\n async config(_userConfig, { command: _command }) {\n const entries = await resolveGlobPatterns(\n resolvedOptions.input,\n resolvedOptions.themeDir,\n );\n\n // Detect DDEV for proxy configuration\n const ddevConfig = await detectDdev(resolvedOptions.themeDir);\n const proxyTarget = ddevConfig ? getDdevSiteUrl(ddevConfig) : undefined;\n\n return {\n build: {\n manifest: true,\n outDir,\n rollupOptions: {\n input: entries,\n },\n },\n server: proxyTarget\n ? {\n proxy: {\n // Vite answers what it can serve, DDEV the rest\n \"/\": {\n target: proxyTarget,\n changeOrigin: true,\n secure: false,\n bypass: (req) =>\n isServedByVite(req, config) ? req.url : undefined,\n },\n },\n }\n : undefined,\n };\n },\n\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n\n configureServer(server: ViteDevServer) {\n const httpServer = server.httpServer;\n if (!httpServer) {\n return;\n }\n\n // Write hot file when server starts, with the address it listens on\n httpServer.once(\"listening\", async () => {\n const address = httpServer.address();\n if (typeof address === \"object\" && address) {\n await writeHotFile(hotPath, getServerUrl(address, config));\n }\n });\n\n // Vite closes the server on SIGTERM only. Ctrl+C (SIGINT) and a\n // closed terminal (SIGHUP) kill the process, and a hot file left\n // behind points every WordPress page at a dead server.\n const onSignal = (signal: NodeJS.Signals) => {\n removeHotFile(hotPath);\n process.exit(128 + constants.signals[signal]);\n };\n for (const signal of EXIT_SIGNALS) {\n process.on(signal, onSignal);\n }\n\n // Remove hot file when server closes\n httpServer.on(\"close\", () => {\n removeHotFile(hotPath);\n for (const signal of EXIT_SIGNALS) {\n process.off(signal, onSignal);\n }\n });\n },\n\n buildEnd() {\n // Ensure hot file is removed after build\n if (config.command === \"build\") {\n removeHotFile(hotPath);\n }\n },\n };\n\n // Separate plugin for file watching (full reload)\n const reloadPlugin = createReloadPlugin(resolvedOptions);\n\n return [mainPlugin, reloadPlugin];\n}\n\n/**\n * Creates a plugin that watches files for full reload.\n */\nfunction createReloadPlugin(options: ResolvedFoehnPluginOptions): Plugin {\n return {\n name: \"foehn:reload\",\n\n configureServer(server: ViteDevServer) {\n // Watch files for full reload\n for (const pattern of options.reload) {\n const fullPattern = resolve(options.themeDir, pattern);\n server.watcher.add(fullPattern);\n }\n\n server.watcher.on(\"change\", (file) => {\n // Check if the changed file matches any reload pattern\n const shouldReload = options.reload.some((pattern) => {\n const fullPattern = resolve(options.themeDir, pattern);\n return matchPattern(file, fullPattern);\n });\n\n if (shouldReload) {\n server.ws.send({ type: \"full-reload\" });\n }\n });\n },\n };\n}\n\n/**\n * Simple pattern matching for file paths.\n */\nfunction matchPattern(file: string, pattern: string): boolean {\n // Convert glob pattern to regex\n const regexPattern = pattern\n .replace(/\\*\\*/g, \"<<<GLOBSTAR>>>\")\n .replace(/\\*/g, \"[^/]*\")\n .replace(/<<<GLOBSTAR>>>/g, \".*\")\n .replace(/\\?/g, \".\");\n\n return new RegExp(`^${regexPattern}$`).test(file);\n}\n\n/**\n * Whether the dev server answers a request itself: its internal routes\n * (`/@vite/client`, `/@fs/`, `/@id/`, `/__open-in-editor`), dependencies, the\n * HMR ping, and every file under the root or the public directory, whatever\n * the query (`?import`, `?direct`, `?v=`).\n */\nfunction isServedByVite(req: IncomingMessage, config: ResolvedConfig): boolean {\n if (req.headers.accept === \"text/x-vite-ping\") {\n return true;\n }\n\n let path: string;\n try {\n path = decodeURIComponent((req.url ?? \"/\").split(/[?#]/)[0]);\n } catch {\n // A malformed URL is not a module, let WordPress answer it\n return false;\n }\n\n if (path.startsWith(\"/@\") || path.startsWith(\"/__\") || path.startsWith(\"/node_modules/\")) {\n return true;\n }\n\n return [config.root, config.publicDir].some(\n (dir) => dir !== \"\" && statSync(join(dir, path), { throwIfNoEntry: false })?.isFile(),\n );\n}\n\n/**\n * Get the URL a browser reaches the dev server at.\n */\nfunction getServerUrl(address: AddressInfo, config: ResolvedConfig): string {\n const protocol = config.server.https ? \"https\" : \"http\";\n const host = [\"::\", \"0.0.0.0\", \"::1\", \"127.0.0.1\"].includes(address.address)\n ? \"localhost\"\n : address.family === \"IPv6\"\n ? `[${address.address}]`\n : address.address;\n return `${protocol}://${host}:${address.port}`;\n}\n"],"mappings":";;;;;;;;;AAmDA,IAAa,iBAA4D;CACrE,QAAQ,CAAC,qBAAqB;CAC9B,QAAQ;CACR,UAAU,QAAQ,IAAI;CACtB,SAAS;AACb;;;;AAKA,SAAgB,eAAe,SAAyD;CASpF,OAAO;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