@intlayer/config
Version:
Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.
55 lines • 1.97 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var detectPlatform_exports = {};
__export(detectPlatform_exports, {
getPlatform: () => getPlatform,
getPrefix: () => getPrefix
});
module.exports = __toCommonJS(detectPlatform_exports);
const import_meta = {};
const getPlatform = () => {
if (typeof import_meta !== "undefined" && typeof import_meta.env !== "undefined" && typeof import_meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "vite";
} else if (typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "next";
} else if (typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "react_app";
} else if (typeof process.env.INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "node";
}
return void 0;
};
const getPrefix = (platform) => {
switch (platform) {
case "next":
return "NEXT_PUBLIC_INTLAYER_";
case "vite":
return "VITE_INTLAYER_";
case "react_app":
return "REACT_APP_INTLAYER_";
default:
return "INTLAYER_";
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getPlatform,
getPrefix
});
//# sourceMappingURL=detectPlatform.cjs.map