main repo

This commit is contained in:
Basilosaurusrex
2025-11-24 18:09:40 +01:00
parent b636ee5e70
commit f027651f9b
34146 changed files with 4436636 additions and 0 deletions

90
node_modules/next/dist/esm/shared/lib/dynamic.js generated vendored Normal file
View File

@@ -0,0 +1,90 @@
import React from "react";
import Loadable from "./loadable.shared-runtime";
const isServerSide = typeof window === "undefined";
// Normalize loader to return the module as form { default: Component } for `React.lazy`.
// Also for backward compatible since next/dynamic allows to resolve a component directly with loader
// Client component reference proxy need to be converted to a module.
function convertModule(mod) {
return {
default: (mod == null ? void 0 : mod.default) || mod
};
}
export function noSSR(LoadableInitializer, loadableOptions) {
// Removing webpack and modules means react-loadable won't try preloading
delete loadableOptions.webpack;
delete loadableOptions.modules;
// This check is necessary to prevent react-loadable from initializing on the server
if (!isServerSide) {
return LoadableInitializer(loadableOptions);
}
const Loading = loadableOptions.loading;
// This will only be rendered on the server side
return ()=>/*#__PURE__*/ React.createElement(Loading, {
error: null,
isLoading: true,
pastDelay: false,
timedOut: false
});
}
export default function dynamic(dynamicOptions, options) {
let loadableFn = Loadable;
let loadableOptions = {
// A loading component is not required, so we default it
loading: (param)=>{
let { error, isLoading, pastDelay } = param;
if (!pastDelay) return null;
if (process.env.NODE_ENV !== "production") {
if (isLoading) {
return null;
}
if (error) {
return /*#__PURE__*/ React.createElement("p", null, error.message, /*#__PURE__*/ React.createElement("br", null), error.stack);
}
}
return null;
}
};
// Support for direct import(), eg: dynamic(import('../hello-world'))
// Note that this is only kept for the edge case where someone is passing in a promise as first argument
// The react-loadable babel plugin will turn dynamic(import('../hello-world')) into dynamic(() => import('../hello-world'))
// To make sure we don't execute the import without rendering first
if (dynamicOptions instanceof Promise) {
loadableOptions.loader = ()=>dynamicOptions;
// Support for having import as a function, eg: dynamic(() => import('../hello-world'))
} else if (typeof dynamicOptions === "function") {
loadableOptions.loader = dynamicOptions;
// Support for having first argument being options, eg: dynamic({loader: import('../hello-world')})
} else if (typeof dynamicOptions === "object") {
loadableOptions = {
...loadableOptions,
...dynamicOptions
};
}
// Support for passing options, eg: dynamic(import('../hello-world'), {loading: () => <p>Loading something</p>})
loadableOptions = {
...loadableOptions,
...options
};
const loaderFn = loadableOptions.loader;
const loader = ()=>loaderFn != null ? loaderFn().then(convertModule) : Promise.resolve(convertModule(()=>null));
// coming from build/babel/plugins/react-loadable-plugin.js
if (loadableOptions.loadableGenerated) {
loadableOptions = {
...loadableOptions,
...loadableOptions.loadableGenerated
};
delete loadableOptions.loadableGenerated;
}
// support for disabling server side rendering, eg: dynamic(() => import('../hello-world'), {ssr: false}).
if (typeof loadableOptions.ssr === "boolean" && !loadableOptions.ssr) {
delete loadableOptions.webpack;
delete loadableOptions.modules;
return noSSR(loadableFn, loadableOptions);
}
return loadableFn({
...loadableOptions,
loader: loader
});
}
//# sourceMappingURL=dynamic.js.map