nit: remove IFFE
This commit is contained in:
parent
d19848c7f4
commit
af5a2a0a4e
1 changed files with 21 additions and 20 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue