nitropack-nightly 2.11.3-20250306-104907.06147e7a → 2.11.3-20250306-120453.de0b4474
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/dist/core/index.mjs
CHANGED
|
@@ -2445,7 +2445,7 @@ async function defaultHandler(error, event, opts) {
|
|
|
2445
2445
|
"content-security-policy": "script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self';"
|
|
2446
2446
|
};
|
|
2447
2447
|
if (statusCode === 404 || !getResponseHeader(event, "cache-control")) {
|
|
2448
|
-
headers["
|
|
2448
|
+
headers["cache-control"] = "no-cache";
|
|
2449
2449
|
}
|
|
2450
2450
|
const body = useJSON ? {
|
|
2451
2451
|
error: true,
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/meta/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
|
-
import { relative, dirname } from "node:path";
|
|
3
|
+
import { relative, dirname, extname } from "node:path";
|
|
4
4
|
import { writeFile } from "nitropack/kit";
|
|
5
|
-
import { parseTOML } from "confbox";
|
|
5
|
+
import { parseTOML, parseJSONC } from "confbox";
|
|
6
6
|
import { readGitConfig, readPackageJSON, findNearestFile } from "pkg-types";
|
|
7
7
|
import { defu } from "defu";
|
|
8
8
|
import { globby } from "globby";
|
|
@@ -159,15 +159,27 @@ export async function enableNodeCompat(nitro) {
|
|
|
159
159
|
workerdHybridNodeCompatPlugin
|
|
160
160
|
);
|
|
161
161
|
}
|
|
162
|
+
const extensionParsers = {
|
|
163
|
+
".json": JSON.parse,
|
|
164
|
+
".jsonc": parseJSONC,
|
|
165
|
+
".toml": parseTOML
|
|
166
|
+
};
|
|
162
167
|
async function readWranglerConfig(nitro) {
|
|
163
|
-
const configPath = await findNearestFile(
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
const configPath = await findNearestFile(
|
|
169
|
+
["wrangler.json", "wrangler.jsonc", "wrangler.toml"],
|
|
170
|
+
{
|
|
171
|
+
startingFrom: nitro.options.rootDir
|
|
172
|
+
}
|
|
173
|
+
).catch(() => void 0);
|
|
166
174
|
if (!configPath) {
|
|
167
175
|
return {};
|
|
168
176
|
}
|
|
169
177
|
const userConfigText = await readFile(configPath, "utf8");
|
|
170
|
-
const
|
|
178
|
+
const parser = extensionParsers[extname(configPath)];
|
|
179
|
+
if (!parser) {
|
|
180
|
+
throw new Error(`Unsupported config file format: ${configPath}`);
|
|
181
|
+
}
|
|
182
|
+
const config = parser(userConfigText);
|
|
171
183
|
return { configPath, config };
|
|
172
184
|
}
|
|
173
185
|
export async function writeWranglerConfig(nitro, cfTarget) {
|
|
@@ -67,7 +67,7 @@ export async function defaultHandler(error, event, opts) {
|
|
|
67
67
|
"content-security-policy": "script-src 'self' 'unsafe-inline'; object-src 'none'; base-uri 'self';"
|
|
68
68
|
};
|
|
69
69
|
if (statusCode === 404 || !getResponseHeader(event, "cache-control")) {
|
|
70
|
-
headers["
|
|
70
|
+
headers["cache-control"] = "no-cache";
|
|
71
71
|
}
|
|
72
72
|
const body = useJSON ? {
|
|
73
73
|
error: true,
|
package/package.json
CHANGED