public static function register_js_var_files( $dir ) {
		if ( ! is_dir( $dir ) ) {
			return [];
		}
		$finder = new Finder();
		$registered = [];
		foreach ( $finder->in( $dir )->name( '*.php' )->files() as $file ) {
			$path = $file->getPathname();
			$file_name = basename( $path );
			if ( preg_match( '#^[_.]#u', $file_name ) ) {
				continue;
			}
			$handle   = str_replace( '.php', '', $file_name );
			$var_name = self::camelize( $handle );
			$vars     = include $path;
			if ( ! is_array( $vars ) ) {
				continue;
			}
			$vars = apply_filters( 'wp_enqueue_manager_vars', $vars, $handle );
			wp_localize_script( $handle, $var_name, $vars );
			$registered[ $handle ] = [
				'name' => $var_name,
				'vars' => $vars,
			];
		}
		return $registered;
	}