@@ -2,7 +2,10 @@ import { writeFileSync } from 'fs'
22import { join } from 'path'
33import * as url from 'url'
44
5- import { LocalProgramArgs , LocalWorkspace } from '@pulumi/pulumi/automation/index.js'
5+ import {
6+ LocalProgramArgs ,
7+ LocalWorkspace ,
8+ } from '@pulumi/pulumi/automation/index.js'
69import {
710 buildServer ,
811 buildOptions ,
@@ -43,7 +46,7 @@ export function adapter({
4346 MEMORY_SIZE ,
4447 zoneName = 'us-east-2' ,
4548 env = { } ,
46- pulumiPaths = [ ]
49+ pulumiPaths = [ ] ,
4750} : AWSAdapterProps = { } ) {
4851 /** @type {import('@sveltejs/kit').Adapter } */
4952 return {
@@ -69,12 +72,13 @@ export function adapter({
6972 serverArgs ,
7073 {
7174 envVars : {
72- 'TS_NODE_IGNORE' : '^(?!.*(sveltekit-adapter-aws-pulumi)).*'
73- }
74- } )
75+ TS_NODE_IGNORE : '^(?!.*(sveltekit-adapter-aws-pulumi)).*' ,
76+ } ,
77+ }
78+ )
7579
7680 // Set the AWS region.
77- await serverStack . setConfig ( " aws:region" , { value : zoneName } ) ;
81+ await serverStack . setConfig ( ' aws:region' , { value : zoneName } )
7882
7983 await serverStack . setAllConfig ( {
8084 projectPath : { value : '.env' } ,
@@ -83,7 +87,6 @@ export function adapter({
8387 memorySizeStr : { value : String ( MEMORY_SIZE ) } ,
8488 } )
8589
86-
8790 const serverStackUpResult = await serverStack . up ( {
8891 onOutput : console . info ,
8992 } )
@@ -103,21 +106,21 @@ export function adapter({
103106 stackName : stackName ,
104107 workDir : mainPath ,
105108 }
106- const mainStack = await LocalWorkspace . createOrSelectStack (
107- mainArgs ,
108- {
109- envVars : {
110- 'TS_NODE_IGNORE' : '^(?!.*(sveltekit-adapter-aws-pulumi)).*'
111- }
112- } )
109+ const mainStack = await LocalWorkspace . createOrSelectStack ( mainArgs , {
110+ envVars : {
111+ TS_NODE_IGNORE : '^(?!.*(sveltekit-adapter-aws-pulumi)).*' ,
112+ } ,
113+ } )
113114
114115 // Set the AWS region.
115- await mainStack . setConfig ( " aws:region" , { value : zoneName } ) ;
116+ await mainStack . setConfig ( ' aws:region' , { value : zoneName } )
116117
117118 await mainStack . setAllConfig ( {
118119 edgePath : { value : edge_directory } ,
119120 staticPath : { value : static_directory } ,
120121 prerenderedPath : { value : prerendered_directory } ,
122+ serverArn : { value : serverStackUpResult . outputs . serverArn . value } ,
123+ optionsArn : { value : serverStackUpResult . outputs . optionsArn . value } ,
121124 } )
122125
123126 if ( FQDN ) {
@@ -131,15 +134,17 @@ export function adapter({
131134 }
132135
133136 const mainStackUpResult = await mainStack . up ( { onOutput : console . info } )
134- const mainAllowedOrigins = JSON . stringify ( mainStackUpResult . outputs . allowedOrigins . value )
135-
137+ const mainAllowedOrigins = JSON . stringify (
138+ mainStackUpResult . outputs . allowedOrigins . value
139+ )
140+
136141 let serverAllowedOrigins : string = ''
137142 const serverConfig = await serverStack . getAllConfig ( )
138-
139- if ( 'allowedOrigins' in serverConfig ) {
143+
144+ if ( 'allowedOrigins' in serverConfig ) {
140145 serverAllowedOrigins = serverConfig [ 'allowedOrigins' ] . value
141146 }
142-
147+
143148 if ( serverAllowedOrigins !== mainAllowedOrigins ) {
144149 // Call the server stack setting the allowed origins
145150 await serverStack . setConfig ( 'allowedOrigins' , {
0 commit comments