nitro 3.0.260415-beta → 3.0.260522-beta
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/THIRD-PARTY-LICENSES.md.gz +0 -0
- package/dist/_build/common.mjs +157 -45
- package/dist/_build/rolldown.mjs +6 -6
- package/dist/_build/rollup.mjs +11 -11
- package/dist/_build/vite.build.mjs +3 -3
- package/dist/_build/vite.dev.mjs +149 -0
- package/dist/_build/vite.env.mjs +177 -0
- package/dist/_chunks/nitro.mjs +241 -14
- package/dist/_chunks/nitro2.mjs +117 -90
- package/dist/_chunks/utils.mjs +4 -4
- package/dist/_common.mjs +2 -2
- package/dist/_dev.d.mts +1 -1
- package/dist/_dev.mjs +7 -6
- package/dist/_libs/c12+rc9.mjs +24 -11
- package/dist/_libs/c12+readdirp+chokidar.d.mts +7 -8
- package/dist/_libs/citty.mjs +1 -1
- package/dist/_libs/common.d.mts +37 -0
- package/dist/_libs/commondir+is-reference.mjs +3 -3
- package/dist/_libs/compatx.d.mts +1 -1
- package/dist/_libs/compatx.mjs +1 -1
- package/dist/_libs/estree+pluginutils.d.mts +1 -1
- package/dist/_libs/estree-walker.mjs +1 -1
- package/dist/_libs/hasown+resolve+deepmerge.mjs +62 -49
- package/dist/_libs/httpxy.d.mts +2 -4
- package/dist/_libs/httpxy.mjs +13 -9
- package/dist/_libs/jsonc-parser+workers-utils.d.mts +1579 -0
- package/dist/_libs/klona.mjs +1 -1
- package/dist/_libs/magic-string.d.mts +1 -1
- package/dist/_libs/mlly.d.mts +1 -1
- package/dist/_libs/nypm+tinyexec.mjs +137 -113
- package/dist/_libs/openapi-types.d.mts +730 -0
- package/dist/_libs/perfect-debounce.mjs +1 -1
- package/dist/_libs/pkg-types.d.mts +8 -5
- package/dist/_libs/plugin-alias.mjs +2 -2
- package/dist/_libs/plugin-inject.mjs +4 -2
- package/dist/_libs/plugin-json.mjs +2 -2
- package/dist/_libs/pluginutils.mjs +18 -5
- package/dist/_libs/readdirp+chokidar.mjs +4 -3
- package/dist/_libs/remapping.mjs +2 -2
- package/dist/_libs/resolve-uri+gen-mapping.mjs +2 -5
- package/dist/_libs/rou3.d.mts +1 -1
- package/dist/_libs/rou3.mjs +1 -1
- package/dist/_libs/std-env.d.mts +1 -1
- package/dist/_libs/tsconfck.mjs +1 -1
- package/dist/_libs/ultrahtml.mjs +1 -1
- package/dist/_libs/unimport+unplugin.mjs +61 -39
- package/dist/_libs/unplugin+unimport.d.mts +4 -4
- package/dist/_libs/unwasm.d.mts +1 -1
- package/dist/_presets.mjs +118 -91
- package/dist/builder.d.mts +1 -1
- package/dist/builder.mjs +3 -3
- package/dist/cli/_chunks/build.mjs +3 -3
- package/dist/cli/_chunks/common.mjs +1 -1
- package/dist/cli/_chunks/deploy.mjs +2 -2
- package/dist/cli/_chunks/dev.mjs +4 -4
- package/dist/cli/_chunks/docs.mjs +1 -1
- package/dist/cli/_chunks/list.mjs +2 -2
- package/dist/cli/_chunks/prepare.mjs +3 -3
- package/dist/cli/_chunks/preview.mjs +4 -4
- package/dist/cli/_chunks/run.mjs +2 -2
- package/dist/cli/_chunks/task.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/docs/0.docs/5.cache.md +53 -9
- package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +3 -3
- package/dist/docs/1.deploy/2.providers/21.vercel.md +6 -0
- package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +1 -1
- package/dist/node_modules/ufo/dist/index.mjs +2 -2
- package/dist/node_modules/ufo/package.json +9 -9
- package/dist/presets/azure/runtime/azure-swa.mjs +2 -0
- package/dist/presets/vercel/runtime/queue.dev.mjs +41 -0
- package/dist/runtime/internal/app.mjs +4 -111
- package/dist/runtime/internal/route-rules.d.mts +1 -0
- package/dist/runtime/internal/route-rules.mjs +29 -1
- package/dist/runtime/internal/routes/scalar.mjs +1 -0
- package/dist/runtime/virtual/app.d.mts +4 -0
- package/dist/runtime/virtual/app.mjs +32 -0
- package/dist/types/index.d.mts +959 -1836
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +23 -331
- package/package.json +43 -44
- package/dist/THIRD-PARTY-LICENSES.md +0 -1646
- package/dist/_chunks/nitro3.mjs +0 -136
- package/dist/_chunks/nitro4.mjs +0 -127
- package/dist/_libs/_.mjs +0 -2
- package/dist/_libs/_2.mjs +0 -2
- package/dist/_libs/_3.mjs +0 -2
- package/dist/_libs/_4.mjs +0 -2
- package/dist/_libs/_5.mjs +0 -2
- package/dist/_libs/_6.mjs +0 -2
- package/dist/_libs/_7.mjs +0 -2
- package/dist/_libs/escape-string-regexp.mjs +0 -5
package/dist/_chunks/nitro2.mjs
CHANGED
|
@@ -1,100 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
async function
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { getBuildInfo, join, prettyPath, resolve } from "../_build/common.mjs";
|
|
2
|
+
import { proxyFetch, proxyUpgrade } from "../_libs/httpxy.mjs";
|
|
3
|
+
import consola from "consola";
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
|
+
async function startPreview(opts) {
|
|
6
|
+
const { outputDir, buildInfo } = await getBuildInfo(opts.rootDir);
|
|
7
|
+
if (!buildInfo) throw new Error("Cannot load nitro build info. Make sure to build first.");
|
|
8
|
+
const info = [
|
|
9
|
+
["Build Directory:", prettyPath(outputDir)],
|
|
10
|
+
["Date:", buildInfo.date && new Date(buildInfo.date).toLocaleString()],
|
|
11
|
+
["Nitro Version:", buildInfo.versions.nitro],
|
|
12
|
+
["Nitro Preset:", buildInfo.preset],
|
|
13
|
+
buildInfo.framework?.name !== "nitro" && ["Framework:", buildInfo.framework?.name + (buildInfo.framework?.version ? ` (v${buildInfo.framework.version})` : "")]
|
|
14
|
+
].filter((i) => i && i[1]);
|
|
15
|
+
consola.box({
|
|
16
|
+
title: " [Build Info] ",
|
|
17
|
+
message: info.map((i) => `- ${i[0]} ${i[1]}`).join("\n")
|
|
18
|
+
});
|
|
19
|
+
const dotEnvEntries = await loadPreviewDotEnv(opts.rootDir);
|
|
20
|
+
if (dotEnvEntries.length > 0) consola.box({
|
|
21
|
+
title: " [Environment Variables] ",
|
|
22
|
+
message: [
|
|
23
|
+
"Loaded variables from .env files (preview mode only).",
|
|
24
|
+
"Set platform environment variables for production:",
|
|
25
|
+
...dotEnvEntries.map(([key, val]) => ` - ${key}`)
|
|
26
|
+
].join("\n")
|
|
27
|
+
});
|
|
28
|
+
if (buildInfo.preset.includes("cloudflare")) {
|
|
29
|
+
if (!buildInfo.commands?.preview) throw new Error(`No nitro build preview command found for the "${buildInfo.preset}" preset.`);
|
|
30
|
+
return await runPreviewCommand({
|
|
31
|
+
command: buildInfo.commands.preview,
|
|
32
|
+
rootDir: opts.rootDir,
|
|
33
|
+
env: dotEnvEntries
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
let fetchHandler = () => Promise.resolve(new Response("Not Found", { status: 404 }));
|
|
37
|
+
if (buildInfo.serverEntry) {
|
|
38
|
+
for (const [key, val] of dotEnvEntries) if (!process.env[key]) process.env[key] = val;
|
|
39
|
+
const { loadServerEntry } = await import("srvx/loader");
|
|
40
|
+
const entry = await loadServerEntry({
|
|
41
|
+
entry: resolve(outputDir, buildInfo.serverEntry),
|
|
42
|
+
...opts.loader
|
|
43
|
+
});
|
|
44
|
+
if (entry.fetch) fetchHandler = entry.fetch;
|
|
45
|
+
}
|
|
46
|
+
if (buildInfo.publicDir) {
|
|
47
|
+
const { serveStatic } = await import("srvx/static");
|
|
48
|
+
const staticHandler = serveStatic({ dir: join(outputDir, buildInfo.publicDir) });
|
|
49
|
+
const originalFetchHandler = fetchHandler;
|
|
50
|
+
fetchHandler = async (req) => {
|
|
51
|
+
const staticRes = await staticHandler(req, () => void 0);
|
|
52
|
+
if (staticRes) return staticRes;
|
|
53
|
+
return originalFetchHandler(req);
|
|
15
54
|
};
|
|
16
55
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
56
|
+
return {
|
|
57
|
+
fetch: fetchHandler,
|
|
58
|
+
async close() {}
|
|
59
|
+
};
|
|
20
60
|
}
|
|
21
|
-
async function
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return handlers;
|
|
31
|
-
}
|
|
32
|
-
async function scanMiddleware(nitro) {
|
|
33
|
-
return (await scanFiles(nitro, "middleware")).map((file) => {
|
|
34
|
-
return {
|
|
35
|
-
route: "/**",
|
|
36
|
-
middleware: true,
|
|
37
|
-
handler: file.fullPath
|
|
38
|
-
};
|
|
61
|
+
async function loadPreviewDotEnv(root) {
|
|
62
|
+
const { loadDotenv } = await import("../_libs/c12+rc9.mjs").then((n) => n.dist_exports);
|
|
63
|
+
const env = await loadDotenv({
|
|
64
|
+
cwd: root,
|
|
65
|
+
fileName: [
|
|
66
|
+
".env.preview",
|
|
67
|
+
".env.production",
|
|
68
|
+
".env"
|
|
69
|
+
]
|
|
39
70
|
});
|
|
71
|
+
return Object.entries(env).filter(([_key, val]) => val);
|
|
40
72
|
}
|
|
41
|
-
async function
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
73
|
+
async function runPreviewCommand(opts) {
|
|
74
|
+
const [arg0, ...args] = opts.command.split(" ");
|
|
75
|
+
consola.info(`Spawning preview server...`);
|
|
76
|
+
consola.info(opts.command);
|
|
77
|
+
console.log("");
|
|
78
|
+
const { getRandomPort, waitForPort } = await import("get-port-please");
|
|
79
|
+
const randomPort = await getRandomPort();
|
|
80
|
+
const child = spawn(arg0, [
|
|
81
|
+
...args,
|
|
82
|
+
"--port",
|
|
83
|
+
String(randomPort),
|
|
84
|
+
"--host",
|
|
85
|
+
"localhost"
|
|
86
|
+
], {
|
|
87
|
+
stdio: "inherit",
|
|
88
|
+
cwd: opts.rootDir,
|
|
89
|
+
env: {
|
|
90
|
+
...process.env,
|
|
91
|
+
...Object.fromEntries(opts.env ?? []),
|
|
92
|
+
PORT: String(randomPort)
|
|
52
93
|
}
|
|
53
|
-
route = route.replace(/\/index$/, "") || "/";
|
|
54
|
-
return {
|
|
55
|
-
handler: file.fullPath,
|
|
56
|
-
lazy: true,
|
|
57
|
-
middleware: false,
|
|
58
|
-
route,
|
|
59
|
-
method,
|
|
60
|
-
env
|
|
61
|
-
};
|
|
62
94
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
return (await scanFiles(nitro, "tasks")).map((f) => {
|
|
69
|
-
return {
|
|
70
|
-
name: f.path.replace(/\/index$/, "").replace(/\.[A-Za-z]+$/, "").replace(/\//g, ":"),
|
|
71
|
-
handler: f.fullPath
|
|
72
|
-
};
|
|
95
|
+
const killChild = (signal) => {
|
|
96
|
+
if (child && !child.killed) child.kill(signal);
|
|
97
|
+
};
|
|
98
|
+
for (const sig of ["SIGINT", "SIGHUP"]) process.once(sig, () => {
|
|
99
|
+
killChild(sig);
|
|
73
100
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
child.once("exit", (code) => {
|
|
102
|
+
if (code && code !== 0) consola.error(`[nitro] Preview server exited with code ${code}`);
|
|
103
|
+
});
|
|
104
|
+
await waitForPort(randomPort, {
|
|
105
|
+
retries: 20,
|
|
106
|
+
delay: 500,
|
|
107
|
+
host: "localhost"
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
fetch(req) {
|
|
111
|
+
return proxyFetch({
|
|
112
|
+
port: randomPort,
|
|
113
|
+
host: "localhost"
|
|
114
|
+
}, req);
|
|
115
|
+
},
|
|
116
|
+
async upgrade(req, socket, head, opts) {
|
|
117
|
+
await proxyUpgrade({
|
|
118
|
+
port: randomPort,
|
|
119
|
+
host: "localhost"
|
|
120
|
+
}, req, socket, head, opts);
|
|
121
|
+
},
|
|
122
|
+
async close() {
|
|
123
|
+
killChild("SIGTERM");
|
|
91
124
|
}
|
|
92
|
-
|
|
93
|
-
})).map((fullPath) => {
|
|
94
|
-
return {
|
|
95
|
-
fullPath,
|
|
96
|
-
path: relative(join(dir, name), fullPath)
|
|
97
|
-
};
|
|
98
|
-
}).sort((a, b) => a.path.localeCompare(b.path));
|
|
125
|
+
};
|
|
99
126
|
}
|
|
100
|
-
export {
|
|
127
|
+
export { startPreview };
|
package/dist/_chunks/utils.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __commonJSMin, __require } from "../_common.mjs";
|
|
2
|
+
import { dirname, glob, m, relative, resolve, resolveModulePath, runParallel, v } from "../_build/common.mjs";
|
|
3
3
|
import { consola as consola$1 } from "consola";
|
|
4
4
|
import { promises } from "node:fs";
|
|
5
5
|
import { promisify } from "node:util";
|
|
@@ -257,9 +257,9 @@ async function importDep(opts, _retry) {
|
|
|
257
257
|
if (!shouldInstall) throw new Error(`\`${opts.id}\` is not installed. Please add it to your dependencies for ${opts.reason}.`);
|
|
258
258
|
const start = Date.now();
|
|
259
259
|
consola$1.start(`Installing \`${opts.id}\` in \`${opts.dir}\`...`);
|
|
260
|
-
const { addDevDependency } = await import("../_libs/
|
|
260
|
+
const { addDevDependency } = await import("../_libs/nypm+tinyexec.mjs").then((n) => n.dist_exports);
|
|
261
261
|
await addDevDependency(opts.id, { cwd: opts.dir });
|
|
262
262
|
consola$1.success(`Installed \`${opts.id}\` in ${opts.dir} (${Date.now() - start}ms).`);
|
|
263
263
|
return importDep(opts, true);
|
|
264
264
|
}
|
|
265
|
-
export { generateFSTree
|
|
265
|
+
export { generateFSTree, importDep };
|
package/dist/_common.mjs
CHANGED
|
@@ -5,7 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
9
|
var __exportAll = (all, no_symbols) => {
|
|
10
10
|
let target = {};
|
|
11
11
|
for (var name in all) __defProp(target, name, {
|
|
@@ -30,4 +30,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
enumerable: true
|
|
31
31
|
}) : target, mod));
|
|
32
32
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
33
|
-
export {
|
|
33
|
+
export { __commonJSMin, __exportAll, __require, __toESM };
|
package/dist/_dev.d.mts
CHANGED
package/dist/_dev.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { extname as extname$1, join as join$1, m, resolve as resolve$1, src_default, v, writeDevBuildInfo } from "./_build/common.mjs";
|
|
2
|
+
import { watch as watch$1 } from "./_libs/readdirp+chokidar.mjs";
|
|
3
|
+
import { debounce } from "./_libs/perfect-debounce.mjs";
|
|
4
|
+
import { createProxyServer } from "./_libs/httpxy.mjs";
|
|
5
5
|
import consola from "consola";
|
|
6
6
|
import { createReadStream } from "node:fs";
|
|
7
7
|
import { readFile, stat as stat$1 } from "node:fs/promises";
|
|
@@ -16,7 +16,8 @@ function createVFSHandler(nitro) {
|
|
|
16
16
|
return defineHandler(async (event) => {
|
|
17
17
|
const { socket } = event.runtime?.node?.req || {};
|
|
18
18
|
const ip = getRequestIP(event, { xForwardedFor: !socket?.remoteAddress && !socket?.localAddress && Object.keys(socket?.address?.() || {}).length === 0 && socket?.readable && socket?.writable && !socket?.remotePort });
|
|
19
|
-
|
|
19
|
+
const v4 = ip?.toLowerCase().startsWith("::ffff:") ? ip.slice(7) : ip;
|
|
20
|
+
if (!(v4 && /^(?:::1|127\.\d+\.\d+\.\d+)$/.test(v4))) throw new HTTPError({
|
|
20
21
|
statusText: `Forbidden IP: "${ip || "?"}"`,
|
|
21
22
|
status: 403
|
|
22
23
|
});
|
|
@@ -506,4 +507,4 @@ var NitroDevServer = class NitroDevServer extends NitroDevApp {
|
|
|
506
507
|
});
|
|
507
508
|
}
|
|
508
509
|
};
|
|
509
|
-
export {
|
|
510
|
+
export { NitroDevApp, NitroDevServer, createDevServer };
|
package/dist/_libs/c12+rc9.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll as __exportAll$1 } from "../_common.mjs";
|
|
2
|
+
import { basename as basename$1, dirname as dirname$1, extname as extname$1, findWorkspaceDir, join as join$1, normalize as normalize$1, readPackageJSON, resolve as resolve$1, resolveModulePath } from "../_build/common.mjs";
|
|
2
3
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
4
|
import * as nodeUtil from "node:util";
|
|
4
5
|
import { readFile, rm } from "node:fs/promises";
|
|
@@ -201,6 +202,13 @@ function readUser(options) {
|
|
|
201
202
|
options.dir = process.env.XDG_CONFIG_HOME || homedir();
|
|
202
203
|
return read(options);
|
|
203
204
|
}
|
|
205
|
+
var dist_exports$1 = /* @__PURE__ */ __exportAll$1({
|
|
206
|
+
SUPPORTED_EXTENSIONS: () => SUPPORTED_EXTENSIONS,
|
|
207
|
+
loadConfig: () => loadConfig,
|
|
208
|
+
loadDotenv: () => loadDotenv,
|
|
209
|
+
setupDotenv: () => setupDotenv,
|
|
210
|
+
watchConfig: () => watchConfig
|
|
211
|
+
});
|
|
204
212
|
async function setupDotenv(options) {
|
|
205
213
|
const targetEnvironment = options.env ?? process.env;
|
|
206
214
|
const environment = await loadDotenv({
|
|
@@ -296,11 +304,11 @@ function getDotEnvVars(targetEnvironment) {
|
|
|
296
304
|
const _normalize = (p) => p?.replace(/\\/g, "/");
|
|
297
305
|
let importCounter = 0;
|
|
298
306
|
const ASYNC_LOADERS = {
|
|
299
|
-
".yaml": () => import("../_build/common.mjs").then((n) => n.
|
|
300
|
-
".yml": () => import("../_build/common.mjs").then((n) => n.
|
|
301
|
-
".jsonc": () => import("../_build/common.mjs").then((n) => n
|
|
302
|
-
".json5": () => import("../_build/common.mjs").then((n) => n.
|
|
303
|
-
".toml": () => import("../_build/common.mjs").then((n) => n.
|
|
307
|
+
".yaml": () => import("../_build/common.mjs").then((n) => n.yaml_exports).then((r) => r.parseYAML),
|
|
308
|
+
".yml": () => import("../_build/common.mjs").then((n) => n.yaml_exports).then((r) => r.parseYAML),
|
|
309
|
+
".jsonc": () => import("../_build/common.mjs").then((n) => n.jsonc_exports).then((r) => r.parseJSONC),
|
|
310
|
+
".json5": () => import("../_build/common.mjs").then((n) => n.json5_exports).then((r) => r.parseJSON5),
|
|
311
|
+
".toml": () => import("../_build/common.mjs").then((n) => n.toml_exports).then((r) => r.parseTOML)
|
|
304
312
|
};
|
|
305
313
|
const SUPPORTED_EXTENSIONS = Object.freeze([
|
|
306
314
|
".js",
|
|
@@ -483,7 +491,7 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
483
491
|
const { downloadTemplate } = await import("giget").catch((error) => {
|
|
484
492
|
throw new Error(`Extending config from \`${source}\` requires \`giget\` peer dependency to be installed.\n\nInstall it with: \`npx nypm i giget\``, { cause: error });
|
|
485
493
|
});
|
|
486
|
-
const { digest } = await
|
|
494
|
+
const { digest } = await Promise.resolve().then(() => ohash_exports).then((n) => n.n);
|
|
487
495
|
const cloneName = source.replace(/\W+/g, "_").split("_").splice(0, 3).join("_") + "_" + digest(source).slice(0, 10).replace(/[-_]/g, "");
|
|
488
496
|
let cloneDir;
|
|
489
497
|
const localNodeModules = resolve$1(options.cwd, "node_modules");
|
|
@@ -531,7 +539,8 @@ async function resolveConfig(source, options, sourceOptions = {}) {
|
|
|
531
539
|
const jiti = createJiti(join$1(options.cwd || ".", options.configFile || "/"), {
|
|
532
540
|
interopDefault: true,
|
|
533
541
|
moduleCache: false,
|
|
534
|
-
extensions: [...SUPPORTED_EXTENSIONS]
|
|
542
|
+
extensions: [...SUPPORTED_EXTENSIONS],
|
|
543
|
+
...options.jitiOptions
|
|
535
544
|
});
|
|
536
545
|
options.import = (id) => jiti.import(id);
|
|
537
546
|
return _resolveModule(await options.import(res.configFile));
|
|
@@ -589,8 +598,8 @@ async function watchConfig(options) {
|
|
|
589
598
|
options.rcFile && resolve$1(l.cwd, typeof options.rcFile === "string" ? options.rcFile : `.${configName}rc`),
|
|
590
599
|
options.packageJson && resolve$1(l.cwd, "package.json")
|
|
591
600
|
]).filter(Boolean))];
|
|
592
|
-
const watch = await import("./readdirp+chokidar.mjs").then((n) => n.
|
|
593
|
-
const { diff } = await
|
|
601
|
+
const watch = await import("./readdirp+chokidar.mjs").then((n) => n.chokidar_exports).then((r) => r.watch || r.default || r);
|
|
602
|
+
const { diff } = await Promise.resolve().then(() => ohash_exports).then((n) => n.t);
|
|
594
603
|
const _fswatcher = watch(watchingFiles, {
|
|
595
604
|
ignoreInitial: true,
|
|
596
605
|
...options.chokidarOptions
|
|
@@ -632,6 +641,10 @@ async function watchConfig(options) {
|
|
|
632
641
|
return config[prop];
|
|
633
642
|
} });
|
|
634
643
|
}
|
|
644
|
+
var ohash_exports = /* @__PURE__ */ __exportAll$1({
|
|
645
|
+
n: () => dist_exports,
|
|
646
|
+
t: () => utils_exports
|
|
647
|
+
});
|
|
635
648
|
var __defProp = Object.defineProperty;
|
|
636
649
|
var __exportAll = (all, no_symbols) => {
|
|
637
650
|
let target = {};
|
|
@@ -811,4 +824,4 @@ var DiffHashedObject = class {
|
|
|
811
824
|
return `${k}(${this.value})`;
|
|
812
825
|
}
|
|
813
826
|
};
|
|
814
|
-
export {
|
|
827
|
+
export { dist_exports$1 as dist_exports, loadConfig, watchConfig };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Stats } from "node:fs";
|
|
2
2
|
import { EventEmitter } from "node:events";
|
|
3
3
|
import { Readable } from "node:stream";
|
|
4
|
+
import * as _$jiti from "jiti";
|
|
4
5
|
import { DownloadTemplateOptions } from "giget";
|
|
5
|
-
//#region node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/utils/index.d.mts
|
|
6
6
|
/**
|
|
7
7
|
* Calculates the difference between two objects and returns a list of differences.
|
|
8
8
|
*
|
|
@@ -29,7 +29,7 @@ declare class DiffHashedObject {
|
|
|
29
29
|
constructor(key: string, value: any, hash?: string | undefined, props?: Record<string, DiffHashedObject> | undefined);
|
|
30
30
|
toString(): string;
|
|
31
31
|
toJSON(): string;
|
|
32
|
-
}
|
|
32
|
+
}
|
|
33
33
|
type AWF = {
|
|
34
34
|
stabilityThreshold: number;
|
|
35
35
|
pollInterval: number;
|
|
@@ -57,7 +57,6 @@ interface MatcherObject {
|
|
|
57
57
|
recursive?: boolean;
|
|
58
58
|
}
|
|
59
59
|
type Matcher = string | RegExp | MatchFunction | MatcherObject;
|
|
60
|
-
//#region src/dotenv.d.ts
|
|
61
60
|
interface DotenvOptions {
|
|
62
61
|
/**
|
|
63
62
|
* The project root directory (either absolute or relative to the current working directory).
|
|
@@ -105,8 +104,8 @@ interface DotenvOptions {
|
|
|
105
104
|
}
|
|
106
105
|
declare global {
|
|
107
106
|
var __c12_dotenv_vars__: Map<Record<string, any>, Set<string>>;
|
|
108
|
-
}
|
|
109
|
-
|
|
107
|
+
}
|
|
108
|
+
type JitiOptions = NonNullable<Parameters<typeof _$jiti.createJiti>[1]>;
|
|
110
109
|
interface ConfigLayerMeta {
|
|
111
110
|
name?: string;
|
|
112
111
|
[key: string]: any;
|
|
@@ -188,6 +187,8 @@ interface LoadConfigOptions<T extends UserInputConfig = UserInputConfig, MT exte
|
|
|
188
187
|
import?: (id: string) => Promise<unknown>;
|
|
189
188
|
/** Custom resolver for picking which export to use from the loaded module. Default: `(mod) => mod.default || mod` */
|
|
190
189
|
resolveModule?: (mod: any) => any;
|
|
190
|
+
/** Options to override defaults when c12 falls back to [jiti](https://github.com/unjs/jiti) for loading config files. */
|
|
191
|
+
jitiOptions?: JitiOptions;
|
|
191
192
|
giget?: false | DownloadTemplateOptions;
|
|
192
193
|
merger?: (...sources: Array<T | null | undefined>) => T;
|
|
193
194
|
extend?: false | {
|
|
@@ -195,8 +196,6 @@ interface LoadConfigOptions<T extends UserInputConfig = UserInputConfig, MT exte
|
|
|
195
196
|
};
|
|
196
197
|
configFileRequired?: boolean;
|
|
197
198
|
}
|
|
198
|
-
//#endregion
|
|
199
|
-
//#region src/watch.d.ts
|
|
200
199
|
type DiffEntries = ReturnType<typeof diff>;
|
|
201
200
|
type ConfigWatcher<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> = ResolvedConfig<T, MT> & {
|
|
202
201
|
watchingFiles: string[];
|
|
@@ -220,4 +219,4 @@ interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT ext
|
|
|
220
219
|
oldConfig: ResolvedConfig<T, MT>;
|
|
221
220
|
}) => void | Promise<void>;
|
|
222
221
|
}
|
|
223
|
-
export {
|
|
222
|
+
export { C12InputConfig, ChokidarOptions, type ConfigWatcher, type DotenvOptions, ResolvedConfig, type WatchConfigOptions };
|
package/dist/_libs/citty.mjs
CHANGED
|
@@ -461,4 +461,4 @@ function _getBuiltinFlags(long, short, userNames, userAliases) {
|
|
|
461
461
|
if (userNames.has(short) || userAliases.has(short)) return [`--${long}`];
|
|
462
462
|
return [`--${long}`, `-${short}`];
|
|
463
463
|
}
|
|
464
|
-
export {
|
|
464
|
+
export { defineCommand, runMain };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface OutputBundleConfig {
|
|
2
|
+
version: "v1";
|
|
3
|
+
runConfig: RunConfig;
|
|
4
|
+
metadata: Metadata;
|
|
5
|
+
outputFiles?: OutputFiles;
|
|
6
|
+
}
|
|
7
|
+
interface RunConfig {
|
|
8
|
+
runCommand: string;
|
|
9
|
+
environmentVariables?: EnvVarConfig[];
|
|
10
|
+
concurrency?: number;
|
|
11
|
+
cpu?: number;
|
|
12
|
+
memoryMiB?: number;
|
|
13
|
+
minInstances?: number;
|
|
14
|
+
maxInstances?: number;
|
|
15
|
+
}
|
|
16
|
+
interface Metadata {
|
|
17
|
+
adapterPackageName: string;
|
|
18
|
+
adapterVersion: string;
|
|
19
|
+
framework: string;
|
|
20
|
+
frameworkVersion?: string;
|
|
21
|
+
}
|
|
22
|
+
interface OutputFiles {
|
|
23
|
+
serverApp: ServerApp;
|
|
24
|
+
}
|
|
25
|
+
interface ServerApp {
|
|
26
|
+
include: string[];
|
|
27
|
+
}
|
|
28
|
+
interface EnvVarConfig {
|
|
29
|
+
variable: string;
|
|
30
|
+
value: string;
|
|
31
|
+
availability: Availability[];
|
|
32
|
+
}
|
|
33
|
+
declare enum Availability {
|
|
34
|
+
Runtime = "RUNTIME",
|
|
35
|
+
Build = "BUILD"
|
|
36
|
+
}
|
|
37
|
+
export { OutputBundleConfig };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { __commonJSMin, __require, __toESM } from "../_common.mjs";
|
|
2
|
+
import { Builder, MagicString, attachScopes, createFilter, extractAssignedNames, makeLegalIdentifier, walk } from "../_build/common.mjs";
|
|
3
3
|
import { existsSync, readFileSync, statSync } from "fs";
|
|
4
4
|
import { basename, dirname, extname, join, relative, resolve, sep } from "path";
|
|
5
5
|
var import_commondir = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -1301,4 +1301,4 @@ function commonjs(options = {}) {
|
|
|
1301
1301
|
}
|
|
1302
1302
|
};
|
|
1303
1303
|
}
|
|
1304
|
-
export { commonjs
|
|
1304
|
+
export { commonjs };
|
package/dist/_libs/compatx.d.mts
CHANGED
|
@@ -42,4 +42,4 @@ type CompatibilityDateSpec = DateString | Partial<CompatibilityDates>;
|
|
|
42
42
|
/**
|
|
43
43
|
* Get compatibility updates applicable for the user given platform and date range.
|
|
44
44
|
*/
|
|
45
|
-
export { CompatibilityDates
|
|
45
|
+
export type { CompatibilityDateSpec, CompatibilityDates, DateString };
|
package/dist/_libs/compatx.mjs
CHANGED
|
@@ -40,4 +40,4 @@ function normalizeDate(date) {
|
|
|
40
40
|
if (date === "latest") return /* @__PURE__ */ new Date();
|
|
41
41
|
return new Date(date);
|
|
42
42
|
}
|
|
43
|
-
export { resolveCompatibilityDates
|
|
43
|
+
export { formatCompatibilityDate, resolveCompatibilityDates, resolveCompatibilityDatesFromEnv };
|