first build
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import process from 'node:process';globalThis._importMeta_=globalThis._importMeta_||{url:"file:///_entry.js",env:process.env};import { u as useRuntimeConfig, c as defineSitemapEventHandler } from '../../../nitro/nitro.mjs';
|
||||
import { createClient } from 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/@supabase/supabase-js/dist/main/index.js';
|
||||
import 'node:http';
|
||||
import 'node:https';
|
||||
import 'node:events';
|
||||
import 'node:buffer';
|
||||
import 'node:fs';
|
||||
import 'node:path';
|
||||
import 'node:crypto';
|
||||
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/vue/index.mjs';
|
||||
import 'node:url';
|
||||
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/consola/dist/index.mjs';
|
||||
import 'file:///mnt/new-volume-7/vue_projects/montify/montify/node_modules/ipx/dist/index.mjs';
|
||||
|
||||
let _client = null;
|
||||
function ensureClient() {
|
||||
if (_client) return _client;
|
||||
const cfg = useRuntimeConfig().public;
|
||||
if (!(cfg == null ? void 0 : cfg.SUPABASE_URL) || !(cfg == null ? void 0 : cfg.SUPABASE_KEY)) {
|
||||
console.warn("[supabase] Missing SUPABASE_URL/KEY in runtimeConfig.public");
|
||||
}
|
||||
_client = createClient(cfg.SUPABASE_URL, cfg.SUPABASE_KEY);
|
||||
return _client;
|
||||
}
|
||||
const supabase = new Proxy({}, {
|
||||
get(_t, prop, receiver) {
|
||||
const c = ensureClient();
|
||||
return Reflect.get(c, prop, receiver);
|
||||
},
|
||||
apply(_t, thisArg, argArray) {
|
||||
var _a, _b;
|
||||
return (_b = (_a = ensureClient()) == null ? void 0 : _a.apply) == null ? void 0 : _b.call(_a, thisArg, argArray);
|
||||
}
|
||||
});
|
||||
|
||||
function resolveBaseURL() {
|
||||
var _a, _b;
|
||||
const envFallback = ((_b = (_a = globalThis._importMeta_) == null ? void 0 : _a.env) == null ? void 0 : _b.NUXT_PUBLIC_DOMAIN_URL) || process.env.NUXT_PUBLIC_DOMAIN_URL || "";
|
||||
const { public: pub } = useRuntimeConfig();
|
||||
return envFallback;
|
||||
}
|
||||
const urls = defineSitemapEventHandler(async () => {
|
||||
const urls = [];
|
||||
try {
|
||||
const { data: categorys, error } = await supabase.from("collections").select(`title`);
|
||||
if (categorys && categorys.length) {
|
||||
categorys.forEach((item) => {
|
||||
urls.push(`${resolveBaseURL()}/search/main?category=${item.title}`);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
try {
|
||||
const { data: brands, error } = await supabase.from("brands").select(`title`);
|
||||
if (brands && brands.length) {
|
||||
brands.forEach((item) => {
|
||||
urls.push(`${resolveBaseURL()}/search/main?brand=${item.title}`);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
try {
|
||||
const { data: products, error } = await supabase.from("products").select(`title`);
|
||||
if (products && products.length) {
|
||||
products.forEach((item) => {
|
||||
urls.push(`${resolveBaseURL()}/product_detail/${item.title}`);
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
urls.push(`${resolveBaseURL()}/`);
|
||||
urls.push(`${resolveBaseURL()}/home`);
|
||||
urls.push(`${resolveBaseURL()}/search`);
|
||||
urls.push(`${resolveBaseURL()}/search/main`);
|
||||
urls.push(`${resolveBaseURL()}/user`);
|
||||
return urls;
|
||||
});
|
||||
|
||||
export { urls as default };
|
||||
@@ -1,35 +1 @@
|
||||
import { Server as Server$1 } from 'node:http';
|
||||
import { Server } from 'node:https';
|
||||
import { A as toNodeListener, l as destr, u as useRuntimeConfig, B as trapUnhandledNodeErrors, C as setupGracefulShutdown, n as useNitroApp } from '../../_/nitro.mjs';
|
||||
|
||||
const cert = process.env.NITRO_SSL_CERT;
|
||||
const key = process.env.NITRO_SSL_KEY;
|
||||
const nitroApp = useNitroApp();
|
||||
const server = cert && key ? new Server({ key, cert }, toNodeListener(nitroApp.h3App)) : new Server$1(toNodeListener(nitroApp.h3App));
|
||||
const port = destr(process.env.NITRO_PORT || process.env.PORT) || 3e3;
|
||||
const host = process.env.NITRO_HOST || process.env.HOST;
|
||||
const path = process.env.NITRO_UNIX_SOCKET;
|
||||
const listener = server.listen(path ? { path } : { port, host }, (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
const protocol = cert && key ? "https" : "http";
|
||||
const addressInfo = listener.address();
|
||||
if (typeof addressInfo === "string") {
|
||||
console.log(`Listening on unix socket ${addressInfo}`);
|
||||
return;
|
||||
}
|
||||
const baseURL = (useRuntimeConfig().app.baseURL || "").replace(/\/$/, "");
|
||||
const url = `${protocol}://${addressInfo.family === "IPv6" ? `[${addressInfo.address}]` : addressInfo.address}:${addressInfo.port}${baseURL}`;
|
||||
console.log(`Listening on ${url}`);
|
||||
});
|
||||
trapUnhandledNodeErrors();
|
||||
setupGracefulShutdown(listener, nitroApp);
|
||||
const nodeServer = {};
|
||||
|
||||
const stories = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
||||
__proto__: null
|
||||
}, Symbol.toStringTag, { value: 'Module' }));
|
||||
|
||||
export { nodeServer as n, stories as s };
|
||||
|
||||
Reference in New Issue
Block a user