nitropack-nightly 2.11.6-20250308-161348.a8e9879e → 2.11.6-20250308-180539.ade85cc9
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
|
@@ -2,7 +2,7 @@ import consola, { consola as consola$1 } from 'consola';
|
|
|
2
2
|
import { createHooks, createDebugger } from 'hookable';
|
|
3
3
|
import { runtimeDir, pkgDir } from 'nitropack/runtime/meta';
|
|
4
4
|
export { runtimeDependencies as nitroRuntimeDependencies } from 'nitropack/runtime/meta';
|
|
5
|
-
import { resolve, relative, join, normalize, isAbsolute, dirname } from 'pathe';
|
|
5
|
+
import { resolve, relative, join as join$1, normalize, isAbsolute, dirname } from 'pathe';
|
|
6
6
|
import { createUnimport, toExports } from 'unimport';
|
|
7
7
|
import { watchConfig, loadConfig } from 'c12';
|
|
8
8
|
import { resolveCompatibilityDatesFromEnv, formatDate, resolveCompatibilityDates, formatCompatibilityDate } from 'compatx';
|
|
@@ -12,7 +12,7 @@ import { existsSync, promises } from 'node:fs';
|
|
|
12
12
|
import defu$1, { defu } from 'defu';
|
|
13
13
|
import { withLeadingSlash, withoutTrailingSlash, withTrailingSlash, withBase, parseURL, joinURL, withoutBase } from 'ufo';
|
|
14
14
|
import { colors } from 'consola/utils';
|
|
15
|
-
import {
|
|
15
|
+
import { join, resolve as resolve$1, dirname as dirname$1 } from 'node:path';
|
|
16
16
|
import escapeRE from 'escape-string-regexp';
|
|
17
17
|
import { resolveModuleExportNames, parseNodeModulePath, lookupNodeModuleSubpath } from 'mlly';
|
|
18
18
|
import { resolveNitroPath, isDirectory, writeFile, prettyPath } from 'nitropack/kit';
|
|
@@ -33,6 +33,7 @@ import { debounce } from 'perfect-debounce';
|
|
|
33
33
|
import * as rollup from 'rollup';
|
|
34
34
|
import { upperFirst } from 'scule';
|
|
35
35
|
import { genTypeImport } from 'knitwork';
|
|
36
|
+
import { resolveModulePath } from 'exsolve';
|
|
36
37
|
import { resolveAlias } from 'pathe/utils';
|
|
37
38
|
import { generateTypes, resolveSchema } from 'untyped';
|
|
38
39
|
import { version } from 'nitropack/meta';
|
|
@@ -43,7 +44,6 @@ import { walk, parse } from 'ultrahtml';
|
|
|
43
44
|
import { createError, getRequestURL, getRequestHeader, getResponseHeader, getRequestHeaders, setResponseHeaders, setResponseStatus, send, eventHandler, getRequestIP, toNodeListener, createApp, fromNodeMiddleware } from 'h3';
|
|
44
45
|
import { Worker } from 'node:worker_threads';
|
|
45
46
|
import { createProxyServer } from 'httpxy';
|
|
46
|
-
import { resolve as resolve$1, dirname as dirname$1 } from 'node:path';
|
|
47
47
|
import { ErrorParser } from 'youch-core';
|
|
48
48
|
import { Youch } from 'youch';
|
|
49
49
|
import { SourceMapConsumer } from 'source-map';
|
|
@@ -345,9 +345,7 @@ async function resolveFetchOptions(options) {
|
|
|
345
345
|
}
|
|
346
346
|
if (!options.experimental.nodeFetchCompat) {
|
|
347
347
|
options.alias = {
|
|
348
|
-
"node-fetch-native/polyfill":
|
|
349
|
-
from: import.meta.url
|
|
350
|
-
}),
|
|
348
|
+
"node-fetch-native/polyfill": join(runtimeDir, "internal/empty"),
|
|
351
349
|
"node-fetch-native/native": "node-fetch-native/native",
|
|
352
350
|
"node-fetch-native": "node-fetch-native/native",
|
|
353
351
|
...options.alias
|
|
@@ -371,7 +369,7 @@ async function resolveImportsOptions(options) {
|
|
|
371
369
|
});
|
|
372
370
|
options.imports.dirs ??= [];
|
|
373
371
|
options.imports.dirs.push(
|
|
374
|
-
...options.scanDirs.map((dir) => join(dir, "utils/**/*"))
|
|
372
|
+
...options.scanDirs.map((dir) => join$1(dir, "utils/**/*"))
|
|
375
373
|
);
|
|
376
374
|
if (Array.isArray(options.imports.exclude) && options.imports.exclude.length === 0) {
|
|
377
375
|
options.imports.exclude.push(/[/\\]\.git[/\\]/);
|
|
@@ -453,7 +451,7 @@ async function resolveOpenAPIOptions(options) {
|
|
|
453
451
|
options.handlers.push({
|
|
454
452
|
route: jsonRoute,
|
|
455
453
|
env: handlersEnv,
|
|
456
|
-
handler: join(runtimeDir, "internal/routes/openapi")
|
|
454
|
+
handler: join$1(runtimeDir, "internal/routes/openapi")
|
|
457
455
|
});
|
|
458
456
|
if (options.openAPI?.ui?.scalar !== false) {
|
|
459
457
|
const scalarRoute = options.openAPI?.ui?.scalar?.route || "/_scalar";
|
|
@@ -461,7 +459,7 @@ async function resolveOpenAPIOptions(options) {
|
|
|
461
459
|
options.handlers.push({
|
|
462
460
|
route: options.openAPI?.ui?.scalar?.route || "/_scalar",
|
|
463
461
|
env: handlersEnv,
|
|
464
|
-
handler: join(runtimeDir, "internal/routes/scalar")
|
|
462
|
+
handler: join$1(runtimeDir, "internal/routes/scalar")
|
|
465
463
|
});
|
|
466
464
|
}
|
|
467
465
|
if (options.openAPI?.ui?.swagger !== false) {
|
|
@@ -470,7 +468,7 @@ async function resolveOpenAPIOptions(options) {
|
|
|
470
468
|
options.handlers.push({
|
|
471
469
|
route: swaggerRoute,
|
|
472
470
|
env: handlersEnv,
|
|
473
|
-
handler: join(runtimeDir, "internal/routes/swagger")
|
|
471
|
+
handler: join$1(runtimeDir, "internal/routes/swagger")
|
|
474
472
|
});
|
|
475
473
|
}
|
|
476
474
|
if (shouldPrerender) {
|
|
@@ -491,10 +489,10 @@ async function resolvePathOptions(options) {
|
|
|
491
489
|
}
|
|
492
490
|
options.alias = {
|
|
493
491
|
...options.alias,
|
|
494
|
-
"~/": join(options.srcDir, "/"),
|
|
495
|
-
"@/": join(options.srcDir, "/"),
|
|
496
|
-
"~~/": join(options.rootDir, "/"),
|
|
497
|
-
"@@/": join(options.rootDir, "/")
|
|
492
|
+
"~/": join$1(options.srcDir, "/"),
|
|
493
|
+
"@/": join$1(options.srcDir, "/"),
|
|
494
|
+
"~~/": join$1(options.rootDir, "/"),
|
|
495
|
+
"@@/": join$1(options.rootDir, "/")
|
|
498
496
|
};
|
|
499
497
|
if (!options.static && !options.entry) {
|
|
500
498
|
throw new Error(
|
|
@@ -705,7 +703,7 @@ async function resolveErrorOptions(options) {
|
|
|
705
703
|
options.errorHandler = [options.errorHandler];
|
|
706
704
|
}
|
|
707
705
|
options.errorHandler.push(
|
|
708
|
-
join(runtimeDir, `internal/error/${options.dev ? "dev" : "prod"}`)
|
|
706
|
+
join$1(runtimeDir, `internal/error/${options.dev ? "dev" : "prod"}`)
|
|
709
707
|
);
|
|
710
708
|
}
|
|
711
709
|
|
|
@@ -1004,7 +1002,7 @@ async function scanFiles(nitro, name) {
|
|
|
1004
1002
|
return files;
|
|
1005
1003
|
}
|
|
1006
1004
|
async function scanDir(nitro, dir, name) {
|
|
1007
|
-
const fileNames = await globby(join(name, GLOB_SCAN_PATTERN), {
|
|
1005
|
+
const fileNames = await globby(join$1(name, GLOB_SCAN_PATTERN), {
|
|
1008
1006
|
cwd: dir,
|
|
1009
1007
|
dot: true,
|
|
1010
1008
|
ignore: nitro.options.ignore,
|
|
@@ -1013,7 +1011,7 @@ async function scanDir(nitro, dir, name) {
|
|
|
1013
1011
|
return fileNames.map((fullPath) => {
|
|
1014
1012
|
return {
|
|
1015
1013
|
fullPath,
|
|
1016
|
-
path: relative(join(dir, name), fullPath)
|
|
1014
|
+
path: relative(join$1(dir, name), fullPath)
|
|
1017
1015
|
};
|
|
1018
1016
|
}).sort((a, b) => a.path.localeCompare(b.path));
|
|
1019
1017
|
}
|
|
@@ -1158,10 +1156,10 @@ async function createNitro(config = {}, opts = {}) {
|
|
|
1158
1156
|
});
|
|
1159
1157
|
if (nitro.options.debug) {
|
|
1160
1158
|
createDebugger(nitro.hooks, { tag: "nitro" });
|
|
1161
|
-
nitro.options.plugins.push(join(runtimeDir, "internal/debug"));
|
|
1159
|
+
nitro.options.plugins.push(join$1(runtimeDir, "internal/debug"));
|
|
1162
1160
|
}
|
|
1163
1161
|
if (nitro.options.timing) {
|
|
1164
|
-
nitro.options.plugins.push(join(runtimeDir, "internal/timing"));
|
|
1162
|
+
nitro.options.plugins.push(join$1(runtimeDir, "internal/timing"));
|
|
1165
1163
|
}
|
|
1166
1164
|
if (nitro.options.logLevel !== void 0) {
|
|
1167
1165
|
nitro.logger.level = nitro.options.logLevel;
|
|
@@ -1254,7 +1252,7 @@ async function writeTypes(nitro) {
|
|
|
1254
1252
|
path = resolvedPath;
|
|
1255
1253
|
} else {
|
|
1256
1254
|
const subpath = await lookupNodeModuleSubpath(resolvedPath);
|
|
1257
|
-
path = join(dir, name, subpath || "");
|
|
1255
|
+
path = join$1(dir, name, subpath || "");
|
|
1258
1256
|
}
|
|
1259
1257
|
}
|
|
1260
1258
|
}
|
|
@@ -1339,21 +1337,21 @@ declare module "nitropack/types" {
|
|
|
1339
1337
|
];
|
|
1340
1338
|
const buildFiles = [];
|
|
1341
1339
|
buildFiles.push({
|
|
1342
|
-
path: join(typesDir, "nitro-routes.d.ts"),
|
|
1340
|
+
path: join$1(typesDir, "nitro-routes.d.ts"),
|
|
1343
1341
|
contents: routes.join("\n")
|
|
1344
1342
|
});
|
|
1345
1343
|
buildFiles.push({
|
|
1346
|
-
path: join(typesDir, "nitro-config.d.ts"),
|
|
1344
|
+
path: join$1(typesDir, "nitro-config.d.ts"),
|
|
1347
1345
|
contents: config.join("\n")
|
|
1348
1346
|
});
|
|
1349
1347
|
buildFiles.push({
|
|
1350
|
-
path: join(typesDir, "nitro-imports.d.ts"),
|
|
1348
|
+
path: join$1(typesDir, "nitro-imports.d.ts"),
|
|
1351
1349
|
contents: [...autoImportedTypes, autoImportExports || "export {}"].join(
|
|
1352
1350
|
"\n"
|
|
1353
1351
|
)
|
|
1354
1352
|
});
|
|
1355
1353
|
buildFiles.push({
|
|
1356
|
-
path: join(typesDir, "nitro.d.ts"),
|
|
1354
|
+
path: join$1(typesDir, "nitro.d.ts"),
|
|
1357
1355
|
contents: declarations.join("\n")
|
|
1358
1356
|
});
|
|
1359
1357
|
if (nitro.options.typescript.generateTsConfig) {
|
|
@@ -1378,55 +1376,55 @@ declare module "nitropack/types" {
|
|
|
1378
1376
|
jsxFragmentFactory: "Fragment",
|
|
1379
1377
|
paths: {
|
|
1380
1378
|
"#imports": [
|
|
1381
|
-
relativeWithDot(tsconfigDir, join(typesDir, "nitro-imports"))
|
|
1379
|
+
relativeWithDot(tsconfigDir, join$1(typesDir, "nitro-imports"))
|
|
1382
1380
|
],
|
|
1383
1381
|
"~/*": [
|
|
1384
1382
|
relativeWithDot(
|
|
1385
1383
|
tsconfigDir,
|
|
1386
|
-
join(nitro.options.alias["~"] || nitro.options.srcDir, "*")
|
|
1384
|
+
join$1(nitro.options.alias["~"] || nitro.options.srcDir, "*")
|
|
1387
1385
|
)
|
|
1388
1386
|
],
|
|
1389
1387
|
"@/*": [
|
|
1390
1388
|
relativeWithDot(
|
|
1391
1389
|
tsconfigDir,
|
|
1392
|
-
join(nitro.options.alias["@"] || nitro.options.srcDir, "*")
|
|
1390
|
+
join$1(nitro.options.alias["@"] || nitro.options.srcDir, "*")
|
|
1393
1391
|
)
|
|
1394
1392
|
],
|
|
1395
1393
|
"~~/*": [
|
|
1396
1394
|
relativeWithDot(
|
|
1397
1395
|
tsconfigDir,
|
|
1398
|
-
join(nitro.options.alias["~~"] || nitro.options.rootDir, "*")
|
|
1396
|
+
join$1(nitro.options.alias["~~"] || nitro.options.rootDir, "*")
|
|
1399
1397
|
)
|
|
1400
1398
|
],
|
|
1401
1399
|
"@@/*": [
|
|
1402
1400
|
relativeWithDot(
|
|
1403
1401
|
tsconfigDir,
|
|
1404
|
-
join(nitro.options.alias["@@"] || nitro.options.rootDir, "*")
|
|
1402
|
+
join$1(nitro.options.alias["@@"] || nitro.options.rootDir, "*")
|
|
1405
1403
|
)
|
|
1406
1404
|
],
|
|
1407
1405
|
...nitro.options.typescript.internalPaths ? {
|
|
1408
1406
|
"nitropack/runtime": [
|
|
1409
|
-
relativeWithDot(tsconfigDir, join(runtimeDir, "index"))
|
|
1407
|
+
relativeWithDot(tsconfigDir, join$1(runtimeDir, "index"))
|
|
1410
1408
|
],
|
|
1411
1409
|
"#internal/nitro": [
|
|
1412
|
-
relativeWithDot(tsconfigDir, join(runtimeDir, "index"))
|
|
1410
|
+
relativeWithDot(tsconfigDir, join$1(runtimeDir, "index"))
|
|
1413
1411
|
],
|
|
1414
1412
|
"nitropack/runtime/*": [
|
|
1415
|
-
relativeWithDot(tsconfigDir, join(runtimeDir, "*"))
|
|
1413
|
+
relativeWithDot(tsconfigDir, join$1(runtimeDir, "*"))
|
|
1416
1414
|
],
|
|
1417
1415
|
"#internal/nitro/*": [
|
|
1418
|
-
relativeWithDot(tsconfigDir, join(runtimeDir, "*"))
|
|
1416
|
+
relativeWithDot(tsconfigDir, join$1(runtimeDir, "*"))
|
|
1419
1417
|
]
|
|
1420
1418
|
} : {}
|
|
1421
1419
|
}
|
|
1422
1420
|
},
|
|
1423
1421
|
include: [
|
|
1424
|
-
relativeWithDot(tsconfigDir, join(typesDir, "nitro.d.ts")).replace(
|
|
1422
|
+
relativeWithDot(tsconfigDir, join$1(typesDir, "nitro.d.ts")).replace(
|
|
1425
1423
|
/^(?=[^.])/,
|
|
1426
1424
|
"./"
|
|
1427
1425
|
),
|
|
1428
|
-
join(relativeWithDot(tsconfigDir, nitro.options.rootDir), "**/*"),
|
|
1429
|
-
...nitro.options.srcDir === nitro.options.rootDir ? [] : [join(relativeWithDot(tsconfigDir, nitro.options.srcDir), "**/*")]
|
|
1426
|
+
join$1(relativeWithDot(tsconfigDir, nitro.options.rootDir), "**/*"),
|
|
1427
|
+
...nitro.options.srcDir === nitro.options.rootDir ? [] : [join$1(relativeWithDot(tsconfigDir, nitro.options.srcDir), "**/*")]
|
|
1430
1428
|
]
|
|
1431
1429
|
});
|
|
1432
1430
|
for (const alias in tsConfig.compilerOptions.paths) {
|
|
@@ -1495,11 +1493,11 @@ async function watchDev(nitro, rollupConfig) {
|
|
|
1495
1493
|
}
|
|
1496
1494
|
const reload = debounce(load);
|
|
1497
1495
|
const watchPatterns = nitro.options.scanDirs.flatMap((dir) => [
|
|
1498
|
-
join(dir, nitro.options.apiDir || "api"),
|
|
1499
|
-
join(dir, nitro.options.routesDir || "routes"),
|
|
1500
|
-
join(dir, "middleware"),
|
|
1501
|
-
join(dir, "plugins"),
|
|
1502
|
-
join(dir, "modules")
|
|
1496
|
+
join$1(dir, nitro.options.apiDir || "api"),
|
|
1497
|
+
join$1(dir, nitro.options.routesDir || "routes"),
|
|
1498
|
+
join$1(dir, "middleware"),
|
|
1499
|
+
join$1(dir, "plugins"),
|
|
1500
|
+
join$1(dir, "modules")
|
|
1503
1501
|
]);
|
|
1504
1502
|
const watchReloadEvents = /* @__PURE__ */ new Set(["add", "addDir", "unlink", "unlinkDir"]);
|
|
1505
1503
|
const reloadWatcher = watch(watchPatterns, { ignoreInitial: true }).on(
|
|
@@ -1714,7 +1712,7 @@ async function _snapshot(nitro) {
|
|
|
1714
1712
|
if (typeof contents !== "string") {
|
|
1715
1713
|
contents = JSON.stringify(contents);
|
|
1716
1714
|
}
|
|
1717
|
-
const fsPath = join(storageDir, path.replace(/:/g, "/"));
|
|
1715
|
+
const fsPath = join$1(storageDir, path.replace(/:/g, "/"));
|
|
1718
1716
|
await promises.mkdir(dirname(fsPath), { recursive: true });
|
|
1719
1717
|
await promises.writeFile(fsPath, contents, "utf8");
|
|
1720
1718
|
})
|
|
@@ -1943,7 +1941,7 @@ async function scanUnprefixedPublicAssets(nitro) {
|
|
|
1943
1941
|
dot: true
|
|
1944
1942
|
});
|
|
1945
1943
|
scannedPaths.push(
|
|
1946
|
-
...publicAssets.map((file) => join(asset.baseURL || "/", file))
|
|
1944
|
+
...publicAssets.map((file) => join$1(asset.baseURL || "/", file))
|
|
1947
1945
|
);
|
|
1948
1946
|
}
|
|
1949
1947
|
return scannedPaths;
|
|
@@ -1954,7 +1952,7 @@ async function copyPublicAssets(nitro) {
|
|
|
1954
1952
|
}
|
|
1955
1953
|
for (const asset of nitro.options.publicAssets) {
|
|
1956
1954
|
const srcDir = asset.dir;
|
|
1957
|
-
const dstDir = join(nitro.options.output.publicDir, asset.baseURL);
|
|
1955
|
+
const dstDir = join$1(nitro.options.output.publicDir, asset.baseURL);
|
|
1958
1956
|
if (await isDirectory(srcDir)) {
|
|
1959
1957
|
const includePatterns = getIncludePatterns(nitro, srcDir);
|
|
1960
1958
|
const publicAssets = await globby(includePatterns, {
|
|
@@ -1964,8 +1962,8 @@ async function copyPublicAssets(nitro) {
|
|
|
1964
1962
|
});
|
|
1965
1963
|
await Promise.all(
|
|
1966
1964
|
publicAssets.map(async (file) => {
|
|
1967
|
-
const src = join(srcDir, file);
|
|
1968
|
-
const dst = join(dstDir, file);
|
|
1965
|
+
const src = join$1(srcDir, file);
|
|
1966
|
+
const dst = join$1(dstDir, file);
|
|
1969
1967
|
if (!existsSync(dst)) {
|
|
1970
1968
|
await promises.cp(src, dst);
|
|
1971
1969
|
}
|
|
@@ -2169,7 +2167,7 @@ async function prerender(nitro) {
|
|
|
2169
2167
|
return _route;
|
|
2170
2168
|
}
|
|
2171
2169
|
if (canWriteToDisk(_route)) {
|
|
2172
|
-
const filePath = join(nitro.options.output.publicDir, _route.fileName);
|
|
2170
|
+
const filePath = join$1(nitro.options.output.publicDir, _route.fileName);
|
|
2173
2171
|
await writeFile(filePath, dataBuff);
|
|
2174
2172
|
nitro._prerenderedRoutes.push(_route);
|
|
2175
2173
|
} else {
|
|
@@ -2302,7 +2300,7 @@ class NodeDevWorker {
|
|
|
2302
2300
|
);
|
|
2303
2301
|
}
|
|
2304
2302
|
#initWorker() {
|
|
2305
|
-
const workerEntryPath = join(this.#workerDir, "index.mjs");
|
|
2303
|
+
const workerEntryPath = join$1(this.#workerDir, "index.mjs");
|
|
2306
2304
|
if (!existsSync(workerEntryPath)) {
|
|
2307
2305
|
this.close(`worker entry not found in "${workerEntryPath}".`);
|
|
2308
2306
|
return;
|
package/dist/meta/index.d.mts
CHANGED
package/dist/meta/index.d.ts
CHANGED
package/dist/meta/index.mjs
CHANGED
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED