Home / File/ index.ts — astro Source File

index.ts — astro Source File

Architecture documentation for index.ts, a typescript file in the astro codebase. 14 imports, 0 dependents.

File typescript CoreAstro CoreMiddleware 14 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  01c2fa75_d554_caf7_1c43_205032b5e695["index.ts"]
  b0429b23_5c71_9282_1b7d_3ac0646fbf3a["./lib/nft.js"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> b0429b23_5c71_9282_1b7d_3ac0646fbf3a
  05f8a956_3476_c8c9_a057_879fb6238b2a["./vite-plugin-config.js"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 05f8a956_3476_c8c9_a057_879fb6238b2a
  349a6247_7703_ff13_e2b6_d319130ff2f9["node:crypto"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 349a6247_7703_ff13_e2b6_d319130ff2f9
  5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 5d6d1861_a18d_b246_cd94_08889ab7e74c
  c2f6615e_96e9_c4eb_5f71_cf120e271705["node:http"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> c2f6615e_96e9_c4eb_5f71_cf120e271705
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  6834f085_c14f_61e4_3720_10435d7dac98["fs"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 6834f085_c14f_61e4_3720_10435d7dac98
  73b7bce3_6086_5697_35d6_0cc8964a1aff["underscore-redirects"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 73b7bce3_6086_5697_35d6_0cc8964a1aff
  784aac79_cb80_513f_cc11_438b93b288c4["functions"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 784aac79_cb80_513f_cc11_438b93b288c4
  61684a62_623b_03b9_8380_dc5b8602892b["vite-plugin"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 61684a62_623b_03b9_8380_dc5b8602892b
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  972c6fe0_4a8d_d55e_c1b0_a57c5bf4ed60["esbuild"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 972c6fe0_4a8d_d55e_c1b0_a57c5bf4ed60
  e64464d4_88a4_c7e2_f90f_758b06231bbe["tinyglobby"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> e64464d4_88a4_c7e2_f90f_758b06231bbe
  3b10c06c_a805_be1f_3a3d_1f00ea858ef5["config"]
  01c2fa75_d554_caf7_1c43_205032b5e695 --> 3b10c06c_a805_be1f_3a3d_1f00ea858ef5
  style 01c2fa75_d554_caf7_1c43_205032b5e695 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { randomUUID } from 'node:crypto';
import { appendFile, mkdir, readFile, writeFile } from 'node:fs/promises';
import type { IncomingMessage } from 'node:http';
import { fileURLToPath, pathToFileURL } from 'node:url';
import { emptyDir } from '@astrojs/internal-helpers/fs';
import { createRedirectsFromAstroRoutes, printAsRedirects } from '@astrojs/underscore-redirects';
import type { Context } from '@netlify/functions';
import netlifyVitePlugin, { type NetlifyPluginOptions } from '@netlify/vite-plugin';
import type {
	AstroConfig,
	AstroIntegration,
	AstroIntegrationLogger,
	HookParameters,
	IntegrationResolvedRoute,
	RouteToHeaders,
} from 'astro';
import { build } from 'esbuild';
import { glob, globSync } from 'tinyglobby';
import { copyDependenciesToFunction } from './lib/nft.js';
import { sessionDrivers } from 'astro/config';
import { createConfigPlugin } from './vite-plugin-config.js';

const { version: packageVersion } = JSON.parse(
	await readFile(new URL('../package.json', import.meta.url), 'utf8'),
);

export interface NetlifyLocals {
	netlify: {
		context: Context;
	};
}

type RemotePattern = AstroConfig['image']['remotePatterns'][number];

/**
 * Convert a remote pattern object to a regex string
 */
export function remotePatternToRegex(
	pattern: RemotePattern,
	logger: AstroIntegrationLogger,
): string | undefined {
	let { protocol, hostname, port, pathname } = pattern;

	let regexStr = '';

	if (protocol) {
		regexStr += `${protocol}://`;
	} else {
		// Default to matching any protocol
		regexStr += '[a-z]+://';
	}

	if (hostname) {
		if (hostname.startsWith('**.')) {
			// match any number of subdomains
			regexStr += '([a-z0-9-]+\\.)*';
			hostname = hostname.substring(3);
		} else if (hostname.startsWith('*.')) {
			// match one subdomain
			regexStr += '([a-z0-9-]+\\.)?';
// ... (712 more lines)

Domain

Subdomains

Dependencies

  • ./lib/nft.js
  • ./vite-plugin-config.js
  • astro
  • config
  • esbuild
  • fs
  • functions
  • node:crypto
  • node:http
  • node:url
  • promises
  • tinyglobby
  • underscore-redirects
  • vite-plugin

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in index.ts?
index.ts defines 5 function(s): netlifyIntegration, remoteImagesFromAstroConfig, remotePatternToRegex, writeNetlifyFrameworkConfig, writeSkewProtectionConfig.
What does index.ts depend on?
index.ts imports 14 module(s): ./lib/nft.js, ./vite-plugin-config.js, astro, config, esbuild, fs, functions, node:crypto, and 6 more.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/netlify/src/index.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/integrations/netlify/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free