Skip to content

Commit

Permalink
feat: update bootstrap layer to 6256b369f54728000a74a8d5 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Apr 13, 2022
1 parent 392b5fe commit e243837
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 36 deletions.
2 changes: 1 addition & 1 deletion deno/bundle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { writeStage2 } from 'https://dinosaurs:are-the-future!@deploy-preview-20--edge-bootstrap.netlify.app/bundler/mod.ts'
import { writeStage2 } from 'https://dinosaurs:are-the-future!@6256b369f54728000a74a8d5--edge-bootstrap.netlify.app/bundler/mod.ts'

const [payload] = Deno.args
const { basePath, destPath, functions } = JSON.parse(payload)
Expand Down
8 changes: 0 additions & 8 deletions src/bootstrap.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/formats/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type { FormatFunction } from '../server/server.js'
import { getFileHash } from '../utils/sha256.js'

const BOOTSTRAP_LATEST =
'https://dinosaurs:are-the-future!@624accb72787800009364b4f--edge-bootstrap.netlify.app/index.ts'
'https://dinosaurs:are-the-future!@6256b369f54728000a74a8d5--edge-bootstrap.netlify.app/bootstrap/index-combined.ts'

interface BundleJSOptions {
buildID: string
Expand Down Expand Up @@ -145,4 +145,4 @@ const getProductionEntryPoint = (functions: EdgeFunction[]) => {
return [bootImport, importLines, exportDeclaration, defaultExport].join('\n\n')
}

export { bundleJS, generateStage2 }
export { bundleJS, generateStage2, getBootstrapURL }
28 changes: 3 additions & 25 deletions test/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@ import { env } from 'process'
import test from 'ava'
import fetch, { Headers } from 'node-fetch'

import { getBootstrapImport } from '../src/bootstrap.js'

const importURLRegex = /^import { boot } from "(.*)";$/m
import { getBootstrapURL } from '../src/formats/javascript.js'

test.serial('Imports the bootstrap layer from a valid URL', async (t) => {
const importLine = getBootstrapImport()
const match = importLine.match(importURLRegex)
const url = match?.[1]

if (url === undefined) {
t.fail('Import expression is invalid')

return
}

const importURL = new URL(url)
const importURL = new URL(getBootstrapURL())
const headers = new Headers()

// `node-fetch` doesn't let us send credentials as part of the URL, so we
Expand All @@ -46,18 +34,8 @@ test.serial(

env.NETLIFY_EDGE_BOOTSTRAP = mockURL

const importLine = getBootstrapImport()
const match = importLine.match(importURLRegex)
const url = match?.[1]
t.is(getBootstrapURL(), mockURL)

env.NETLIFY_EDGE_BOOTSTRAP = undefined

if (url === undefined) {
t.fail('Import expression is invalid')

return
}

t.is(url, mockURL)
},
)

0 comments on commit e243837

Please sign in to comment.