* web: Check JS files. Add types. * web: Fix issues surrounding Vite/ESBuild types. * web: Clean up version constants. Tidy types * web: Clean up docs, types. * web: Clean up package paths. * web: (ESLint) no-lonely-if * web: Render slot before navbar. * web: Fix line-height alignment. * web: Truncate long headers. * web: Clean up page header declarations. Add story. Update paths. * web: Ignore out directory. * web: Lint Lit. * web: Use private alias. * web: Fix implicit CJS mode. * web: Update deps. * web: await all imports.
		
			
				
	
	
		
			30 lines
		
	
	
		
			927 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			927 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * @file Bundler utilities.
 | 
						|
 */
 | 
						|
import { NodeEnvironment, serializeEnvironmentVars } from "@goauthentik/core/environment/node";
 | 
						|
import { AuthentikVersion } from "@goauthentik/core/version/node";
 | 
						|
 | 
						|
/**
 | 
						|
 * Creates a mapping of environment variables to their respective runtime constants.
 | 
						|
 */
 | 
						|
export function createBundleDefinitions() {
 | 
						|
    const SerializedNodeEnvironment = /** @type {`"development"` | `"production"`} */ (
 | 
						|
        JSON.stringify(NodeEnvironment)
 | 
						|
    );
 | 
						|
 | 
						|
    /**
 | 
						|
     * @satisfies {Record<ESBuildImportEnvKey, string>}
 | 
						|
     */
 | 
						|
    const envRecord = {
 | 
						|
        AK_VERSION: AuthentikVersion,
 | 
						|
        AK_API_BASE_PATH: process.env.AK_API_BASE_PATH ?? "",
 | 
						|
    };
 | 
						|
 | 
						|
    return {
 | 
						|
        ...serializeEnvironmentVars(envRecord),
 | 
						|
        // We need to explicitly set this for NPM packages that use `process`
 | 
						|
        // to determine their environment.
 | 
						|
        "process.env.NODE_ENV": SerializedNodeEnvironment,
 | 
						|
    };
 | 
						|
}
 |