nitropack-nightly 2.11.3-20250306-104907.06147e7a → 2.11.3-20250306-111821.d219707f
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/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) {
|
package/package.json
CHANGED