@djangocfg/nextjs 2.1.576 → 2.1.578
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/config/index.d.mts +26 -1
- package/dist/config/index.mjs +10 -0
- package/dist/config/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -9
- package/src/config/index.ts +3 -0
- package/src/config/indexnow.test.ts +23 -0
- package/src/config/indexnow.ts +27 -0
package/dist/config/index.d.mts
CHANGED
|
@@ -348,6 +348,31 @@ type BaseNextConfigOptions = DjangoCfgNextOptions & Omit<NextConfig, keyof Djang
|
|
|
348
348
|
*/
|
|
349
349
|
declare function createBaseNextConfig(options?: BaseNextConfigOptions): NextConfig;
|
|
350
350
|
|
|
351
|
+
/**
|
|
352
|
+
* IndexNow key file, served by Django.
|
|
353
|
+
*
|
|
354
|
+
* The protocol proves host ownership by fetching `https://<host>/<key>.txt`.
|
|
355
|
+
* Django answers it at `/cfg/sitemap/indexnow/<key>.txt` from
|
|
356
|
+
* `IndexNowConfig` — only the configured key, every other name 404s — so the
|
|
357
|
+
* key lives in one place and the frontend ships no file.
|
|
358
|
+
*
|
|
359
|
+
* Put it in `fallback`: real public files and routes (`robots.txt`,
|
|
360
|
+
* `llms-full.txt`) match the same shape and must win.
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```ts
|
|
364
|
+
* import { indexNowKeyRewrite } from '@djangocfg/nextjs/config';
|
|
365
|
+
*
|
|
366
|
+
* async rewrites() {
|
|
367
|
+
* return { beforeFiles: [], afterFiles: [], fallback: [indexNowKeyRewrite(API_URL)] };
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
declare function indexNowKeyRewrite(apiUrl: string): {
|
|
372
|
+
source: string;
|
|
373
|
+
destination: string;
|
|
374
|
+
};
|
|
375
|
+
|
|
351
376
|
/**
|
|
352
377
|
* Shared Constants for DjangoCFG Next.js Configuration
|
|
353
378
|
*/
|
|
@@ -647,4 +672,4 @@ declare function addCompressionPlugins(config: Configuration, options?: Compress
|
|
|
647
672
|
*/
|
|
648
673
|
declare function isCompressionAvailable(): boolean;
|
|
649
674
|
|
|
650
|
-
export { type BaseNextConfigOptions, CSP_BASELINE_VENDORS, CSP_VENDOR_PRESETS, type CompressionPluginOptions, type CspOrigins, type CspVendor, DEFAULT_OPTIMIZE_PACKAGES, DEFAULT_TRANSPILE_PACKAGES, DJANGOCFG_PACKAGES, DJANGO_CFG_BANNER, DevStartupPlugin, type DevStartupPluginOptions, type InstallOptions, type InstallProgress, type MissingPackage, OPTIONAL_PACKAGES, PACKAGE_NAME, PEER_DEPENDENCIES, type PackageDefinition, type PackageVersion, type UpdateOptions, addCompressionPlugins, buildInstallCommand, buildSingleInstallCommand, checkAndInstallPackages, checkAndUpdatePackages, checkForUpdate, checkForUpdates, checkPackages, createBaseNextConfig, deepMerge, detectPackageManager, fetchLatestVersion, getApiUrl, getBasePath, getCurrentVersion, getInstalledVersion, getMissingPackages, getOutdatedPackages, getPackagesForContext, getSiteUrl, getUpdateCommand, installPackages, installPackagesWithProgress, isCI, isCompressionAvailable, isDev, isPackageInstalled, isProduction, isStaticBuild, printVersionInfo, resetDevStartupState, resetInstallerPreferences, resetUpdaterPreferences, resolveCspVendors, updatePackagesWithProgress };
|
|
675
|
+
export { type BaseNextConfigOptions, CSP_BASELINE_VENDORS, CSP_VENDOR_PRESETS, type CompressionPluginOptions, type CspOrigins, type CspVendor, DEFAULT_OPTIMIZE_PACKAGES, DEFAULT_TRANSPILE_PACKAGES, DJANGOCFG_PACKAGES, DJANGO_CFG_BANNER, DevStartupPlugin, type DevStartupPluginOptions, type InstallOptions, type InstallProgress, type MissingPackage, OPTIONAL_PACKAGES, PACKAGE_NAME, PEER_DEPENDENCIES, type PackageDefinition, type PackageVersion, type UpdateOptions, addCompressionPlugins, buildInstallCommand, buildSingleInstallCommand, checkAndInstallPackages, checkAndUpdatePackages, checkForUpdate, checkForUpdates, checkPackages, createBaseNextConfig, deepMerge, detectPackageManager, fetchLatestVersion, getApiUrl, getBasePath, getCurrentVersion, getInstalledVersion, getMissingPackages, getOutdatedPackages, getPackagesForContext, getSiteUrl, getUpdateCommand, indexNowKeyRewrite, installPackages, installPackagesWithProgress, isCI, isCompressionAvailable, isDev, isPackageInstalled, isProduction, isStaticBuild, printVersionInfo, resetDevStartupState, resetInstallerPreferences, resetUpdaterPreferences, resolveCspVendors, updatePackagesWithProgress };
|
package/dist/config/index.mjs
CHANGED
|
@@ -1476,6 +1476,15 @@ function createBaseNextConfig(options = {}) {
|
|
|
1476
1476
|
}
|
|
1477
1477
|
return finalConfig;
|
|
1478
1478
|
}
|
|
1479
|
+
|
|
1480
|
+
// src/config/indexnow.ts
|
|
1481
|
+
function indexNowKeyRewrite(apiUrl) {
|
|
1482
|
+
return {
|
|
1483
|
+
// The protocol's key alphabet and length, at the site root only.
|
|
1484
|
+
source: "/:key([A-Za-z0-9-]{8,128}).txt",
|
|
1485
|
+
destination: `${apiUrl.replace(/\/+$/, "")}/cfg/sitemap/indexnow/:key.txt`
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1479
1488
|
export {
|
|
1480
1489
|
AI_DOCS_HINT,
|
|
1481
1490
|
CSP_BASELINE_VENDORS,
|
|
@@ -1512,6 +1521,7 @@ export {
|
|
|
1512
1521
|
getPackagesForContext,
|
|
1513
1522
|
getSiteUrl,
|
|
1514
1523
|
getUpdateCommand,
|
|
1524
|
+
indexNowKeyRewrite,
|
|
1515
1525
|
installPackages,
|
|
1516
1526
|
installPackagesWithProgress,
|
|
1517
1527
|
isCI,
|