nit: remove IFFE

This commit is contained in:
bholmesdev 2023-03-06 09:47:16 -05:00
parent d19848c7f4
commit af5a2a0a4e

View file

@ -97,29 +97,30 @@ export async function runHookConfigSetup({
},
};
// ---
// Public, intentionally undocumented hooks - not subject to semver.
// Intended for internal integrations (ex. `@astrojs/mdx`),
// though accessible to integration authors if discovered.
(function applySemiPrivateHooks() {
function addPageExtension(...input: (string | string[])[]) {
const exts = (input.flat(Infinity) as string[]).map((ext) => `.${ext.replace(/^\./, '')}`);
updatedSettings.pageExtensions.push(...exts);
}
function addContentEntryType(contentEntryType: ContentEntryType) {
updatedSettings.contentEntryTypes.push(contentEntryType);
}
Object.defineProperty(hooks, 'addPageExtension', {
value: addPageExtension,
writable: false,
enumerable: false,
});
Object.defineProperty(hooks, 'addContentEntryType', {
value: addContentEntryType,
writable: false,
enumerable: false,
});
})();
function addPageExtension(...input: (string | string[])[]) {
const exts = (input.flat(Infinity) as string[]).map((ext) => `.${ext.replace(/^\./, '')}`);
updatedSettings.pageExtensions.push(...exts);
}
function addContentEntryType(contentEntryType: ContentEntryType) {
updatedSettings.contentEntryTypes.push(contentEntryType);
}
Object.defineProperty(hooks, 'addPageExtension', {
value: addPageExtension,
writable: false,
enumerable: false,
});
Object.defineProperty(hooks, 'addContentEntryType', {
value: addContentEntryType,
writable: false,
enumerable: false,
});
// ---
await withTakingALongTimeMsg({
name: integration.name,