Rename global variables
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
export default function ({ path }) {
|
||||
for (let i = 0; i < global.CONSTANTS.RouteIgnorePatterns.length; i++) {
|
||||
const regex = global.CONSTANTS.RouteIgnorePatterns[i];
|
||||
for (let i = 0; i < global.BUNEXT_CONSTANTS.RouteIgnorePatterns.length; i++) {
|
||||
const regex = global.BUNEXT_CONSTANTS.RouteIgnorePatterns[i];
|
||||
if (path.match(regex))
|
||||
return true;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -6,8 +6,8 @@ export default function grabAppPort() {
|
||||
if (process.env.PORT) {
|
||||
return numberfy(process.env.PORT);
|
||||
}
|
||||
if (global.CONFIG.port) {
|
||||
return global.CONFIG.port;
|
||||
if (global.BUNEXT_CONFIG.port) {
|
||||
return global.BUNEXT_CONFIG.port;
|
||||
}
|
||||
return numberfy(defaultPort);
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
import AppNames from "./grab-app-names";
|
||||
export default function grabAssetsPrefix() {
|
||||
if (global.CONFIG.assets_prefix) {
|
||||
return global.CONFIG.assets_prefix;
|
||||
if (global.BUNEXT_CONFIG.assets_prefix) {
|
||||
return global.BUNEXT_CONFIG.assets_prefix;
|
||||
}
|
||||
const { defaultAssetPrefix } = AppNames;
|
||||
return defaultAssetPrefix;
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
export default function grabConstants() {
|
||||
const config = global.CONFIG;
|
||||
const config = global.BUNEXT_CONFIG;
|
||||
const MB_IN_BYTES = 1024 * 1024;
|
||||
const ClientWindowPagePropsName = "__PAGE_PROPS__";
|
||||
const ClientRootElementIDName = "__bunext";
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
import path from "path";
|
||||
export default function grabDirNames() {
|
||||
if (global.DIR_NAMES)
|
||||
return global.DIR_NAMES;
|
||||
if (global.BUNEXT_DIR_NAMES)
|
||||
return global.BUNEXT_DIR_NAMES;
|
||||
const ROOT_DIR = process.cwd();
|
||||
const SRC_DIR = path.join(ROOT_DIR, "src");
|
||||
const PAGES_DIR = path.join(SRC_DIR, "pages");
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
import grabAppPort from "./grab-app-port";
|
||||
export default function grabOrigin() {
|
||||
if (global.CONFIG.origin) {
|
||||
return global.CONFIG.origin;
|
||||
if (global.BUNEXT_CONFIG.origin) {
|
||||
return global.BUNEXT_CONFIG.origin;
|
||||
}
|
||||
const port = grabAppPort();
|
||||
return `http://localhost:${port}`;
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ export default async function grabRouteParams({ req, query: passed_query, }) {
|
||||
url,
|
||||
query: _.merge(query, passed_query),
|
||||
body,
|
||||
server: global.SERVER,
|
||||
server: global.BUNEXT_SERVER,
|
||||
};
|
||||
return routeParams;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -1,6 +1,6 @@
|
||||
export default function grabRouter() {
|
||||
// if (process.env.NODE_ENV !== "production") {
|
||||
// global.ROUTER.reload();
|
||||
// global.BUNEXT_ROUTER.reload();
|
||||
// }
|
||||
return global.ROUTER;
|
||||
return global.BUNEXT_ROUTER;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -21,5 +21,5 @@ export const log = {
|
||||
build: (msg) => console.log(`${prefix.build} ${chalk.magenta(msg)}`),
|
||||
watch: (msg) => console.log(`${prefix.watch} ${chalk.blue(msg)}`),
|
||||
server: (url) => console.log(`${prefix.success} ${chalk.white("Server running on")} ${chalk.cyan.underline(url)}`),
|
||||
banner: () => console.log(`\n ${chalk.cyan.bold(AppNames.name)} ${chalk.gray(`v${global.CURRENT_VERSION || AppNames["version"]}`)}\n`),
|
||||
banner: () => console.log(`\n ${chalk.cyan.bold(AppNames.name)} ${chalk.gray(`v${global.BUNEXT_CURRENT_VERSION || AppNames["version"]}`)}\n`),
|
||||
};
|
||||
|
||||
Vendored
+1
-1
@@ -5,5 +5,5 @@ export default function refreshRouter() {
|
||||
style: "nextjs",
|
||||
dir: PAGES_DIR,
|
||||
});
|
||||
global.ROUTER = router;
|
||||
global.BUNEXT_ROUTER = router;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user