nimbus-docs 0.1.13 → 0.1.14
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/cli/index.js +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/cli/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3309,12 +3309,12 @@ async function collectDocsPages(projectRoot, docsBase = "src/content/docs") {
|
|
|
3309
3309
|
* embeds, so editing a partial invalidates exactly the pages that reference
|
|
3310
3310
|
* it (directly or transitively) and nothing else.
|
|
3311
3311
|
*/
|
|
3312
|
-
async function setupIncrementalContext(projectRoot, cacheDir, logger, partialResolver) {
|
|
3312
|
+
async function setupIncrementalContext(projectRoot, cacheDir, logger, partialResolver, srcDir) {
|
|
3313
3313
|
const cache = new Cache(cacheDir ? resolve(cacheDir, "nimbus") : resolve(projectRoot, ".nimbus/cache"));
|
|
3314
3314
|
const globalHash = await computeGlobalHash(projectRoot);
|
|
3315
3315
|
const namespace = await resolveCacheNamespace(projectRoot);
|
|
3316
3316
|
const priorManifest = await cache.readManifest();
|
|
3317
|
-
const bases = await parseCollectionBases(resolve(projectRoot, "src
|
|
3317
|
+
const bases = await parseCollectionBases(resolve(srcDir ?? resolve(projectRoot, "src"), "content.config.ts"));
|
|
3318
3318
|
const { bytesByPathname, filePathByPathname } = await collectDocsPages(projectRoot, await pickCollectionBase(projectRoot, resolveCollectionBase(projectRoot, bases?.get("docs") ?? "docs", "docs"), "src/content/docs"));
|
|
3319
3319
|
const partialsBase = await pickCollectionBase(projectRoot, resolveCollectionBase(projectRoot, bases?.get("partials") ?? "partials", "partials"), "src/content/partials");
|
|
3320
3320
|
const resolver = partialResolver ?? makeDefaultPartialResolver(projectRoot, partialsBase);
|
|
@@ -4082,6 +4082,7 @@ function nimbus(rawConfig, options = {}) {
|
|
|
4082
4082
|
collections: options.collections
|
|
4083
4083
|
}, IMPLEMENTED_CODES);
|
|
4084
4084
|
let projectRootForBuild = "";
|
|
4085
|
+
let srcDirForBuild = "";
|
|
4085
4086
|
let cacheDirForBuild = "";
|
|
4086
4087
|
let astroBaseForBuild = "";
|
|
4087
4088
|
let incrementalCtx = null;
|
|
@@ -4091,12 +4092,13 @@ function nimbus(rawConfig, options = {}) {
|
|
|
4091
4092
|
hooks: {
|
|
4092
4093
|
"astro:config:setup": async (params) => {
|
|
4093
4094
|
const { updateConfig, config: astroConfig, logger } = params;
|
|
4095
|
+
const srcDir = fileURLToPath(astroConfig.srcDir);
|
|
4094
4096
|
const integrationsToAdd = [];
|
|
4095
4097
|
materializeLintConfig(fileURLToPath(astroConfig.root), lintOptions.rules, lintOptions.collections, config.site);
|
|
4096
4098
|
if (options.validateMdx !== false) {
|
|
4097
4099
|
const validateOpts = typeof options.validateMdx === "object" ? options.validateMdx : {};
|
|
4098
4100
|
const projectRoot = fileURLToPath(astroConfig.root);
|
|
4099
|
-
const componentsPath = path.isAbsolute(validateOpts.componentsPath
|
|
4101
|
+
const componentsPath = validateOpts.componentsPath ? path.isAbsolute(validateOpts.componentsPath) ? validateOpts.componentsPath : path.join(projectRoot, validateOpts.componentsPath) : path.join(srcDir, "components.ts");
|
|
4100
4102
|
const globals = await parseComponentsRegistry(componentsPath);
|
|
4101
4103
|
if (globals === null) logger.warn(`MDX validation disabled: \`${path.relative(projectRoot, componentsPath)}\` is missing or does not export a parseable \`components\` object. Create the file with \`export const components = { /* ... */ };\` or set \`validateMdx: false\` to silence this warning.`);
|
|
4102
4104
|
else {
|
|
@@ -4113,10 +4115,11 @@ function nimbus(rawConfig, options = {}) {
|
|
|
4113
4115
|
}
|
|
4114
4116
|
const projectRoot = fileURLToPath(astroConfig.root);
|
|
4115
4117
|
projectRootForBuild = projectRoot;
|
|
4118
|
+
srcDirForBuild = srcDir;
|
|
4116
4119
|
cacheDirForBuild = fileURLToPath(astroConfig.cacheDir);
|
|
4117
4120
|
astroBaseForBuild = astroConfig.base ?? "";
|
|
4118
4121
|
const codeBlockLangs = await scanCodeBlockLanguages(projectRoot, SHIKI_LANG_ALIAS);
|
|
4119
|
-
const contentConfigPath = path.join(
|
|
4122
|
+
const contentConfigPath = path.join(srcDir, "content.config.ts");
|
|
4120
4123
|
const rawCollections = await parseContentCollections(contentConfigPath);
|
|
4121
4124
|
const collectionBases = await parseCollectionBases(contentConfigPath);
|
|
4122
4125
|
const indexedCollections = rawCollections === null ? ["docs"] : filterIndexableCollections(rawCollections);
|
|
@@ -4131,7 +4134,7 @@ function nimbus(rawConfig, options = {}) {
|
|
|
4131
4134
|
url: contentEntryUrl(entry, versionInfo),
|
|
4132
4135
|
source: `src/content/${entry.relPath}`
|
|
4133
4136
|
}));
|
|
4134
|
-
const pageOwners = enumerateStaticPageRoutes(path.join(
|
|
4137
|
+
const pageOwners = enumerateStaticPageRoutes(path.join(srcDir, "pages"), projectRoot);
|
|
4135
4138
|
const duplicateRoutes = findDuplicateRoutes([...contentOwners, ...pageOwners]);
|
|
4136
4139
|
if (duplicateRoutes.length > 0) throw new Error(formatDuplicateRoutes(duplicateRoutes));
|
|
4137
4140
|
if (config.versions && rawCollections !== null) {
|
|
@@ -4231,7 +4234,7 @@ function nimbus(rawConfig, options = {}) {
|
|
|
4231
4234
|
logger.warn("[incremental] project root unknown at build:start; cache disabled this run");
|
|
4232
4235
|
return;
|
|
4233
4236
|
}
|
|
4234
|
-
incrementalCtx = await setupIncrementalContext(projectRootForBuild, cacheDirForBuild || void 0, logger, options.partialResolver);
|
|
4237
|
+
incrementalCtx = await setupIncrementalContext(projectRootForBuild, cacheDirForBuild || void 0, logger, options.partialResolver, srcDirForBuild || void 0);
|
|
4235
4238
|
mdxSkipCtx.cachedAbsolutePaths.clear();
|
|
4236
4239
|
for (const pathname of incrementalCtx.cacheableHits) {
|
|
4237
4240
|
const filePath = incrementalCtx.filePathByPathname.get(pathname);
|