-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: return features
from server
#481
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7afcf20
feat: return `features` from server
eduardoboucas 4a2df89
fix: update Deno version
eduardoboucas cd0ee00
chore: revert bootstrap version locking
eduardoboucas 39ffee2
chore: add debug logging
eduardoboucas 99520c8
fix: look for absolute paths
eduardoboucas d262851
refactor: wrap npm vendoring in feature flag
eduardoboucas e7f474d
refactor: revert version bump
eduardoboucas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { DenoBridge, OnAfterDownloadHook, OnBeforeDownloadHook, ProcessRef } from '../bridge.js' | ||
import { getFunctionConfig, FunctionConfig } from '../config.js' | ||
import type { EdgeFunction } from '../edge_function.js' | ||
import type { FeatureFlags } from '../feature_flags.js' | ||
import { generateStage2 } from '../formats/javascript.js' | ||
import { ImportMap } from '../import_map.js' | ||
import { getLogger, LogFunction, Logger } from '../logger.js' | ||
|
@@ -18,6 +19,7 @@ interface PrepareServerOptions { | |
distDirectory: string | ||
distImportMapPath?: string | ||
entryPoint?: string | ||
featureFlags?: FeatureFlags | ||
flags: string[] | ||
formatExportTypeError?: FormatFunction | ||
formatImportError?: FormatFunction | ||
|
@@ -36,6 +38,7 @@ const prepareServer = ({ | |
deno, | ||
distDirectory, | ||
distImportMapPath, | ||
featureFlags, | ||
flags: denoFlags, | ||
formatExportTypeError, | ||
formatImportError, | ||
|
@@ -64,17 +67,22 @@ const prepareServer = ({ | |
formatImportError, | ||
}) | ||
|
||
const features: Record<string, boolean> = {} | ||
const importMap = baseImportMap.clone() | ||
const vendor = await vendorNPMSpecifiers({ | ||
basePath, | ||
directory: distDirectory, | ||
functions: functions.map(({ path }) => path), | ||
importMap, | ||
logger, | ||
}) | ||
|
||
if (vendor) { | ||
importMap.add(vendor.importMap) | ||
if (featureFlags?.edge_functions_npm_modules) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm assuming that you're planning on statically setting this flag from CLI, or do you want to roll this out via DevCycle? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using DevCycle. |
||
const vendor = await vendorNPMSpecifiers({ | ||
basePath, | ||
directory: distDirectory, | ||
functions: functions.map(({ path }) => path), | ||
importMap, | ||
logger, | ||
}) | ||
|
||
if (vendor) { | ||
features.npmModules = true | ||
importMap.add(vendor.importMap) | ||
} | ||
} | ||
|
||
try { | ||
|
@@ -116,6 +124,7 @@ const prepareServer = ({ | |
const success = await waitForServer(port, processRef.ps) | ||
|
||
return { | ||
features, | ||
functionsConfig, | ||
graph, | ||
success, | ||
|
@@ -141,6 +150,7 @@ interface ServeOptions { | |
certificatePath?: string | ||
debug?: boolean | ||
distImportMapPath?: string | ||
featureFlags?: FeatureFlags | ||
inspectSettings?: InspectSettings | ||
importMapPaths?: string[] | ||
onAfterDownload?: OnAfterDownloadHook | ||
|
@@ -159,6 +169,7 @@ export const serve = async ({ | |
debug, | ||
distImportMapPath, | ||
inspectSettings, | ||
featureFlags, | ||
formatExportTypeError, | ||
formatImportError, | ||
importMapPaths = [], | ||
|
@@ -212,6 +223,7 @@ export const serve = async ({ | |
deno, | ||
distDirectory: servePath, | ||
distImportMapPath, | ||
featureFlags, | ||
flags, | ||
formatExportTypeError, | ||
formatImportError, | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes an issue where importing an absolute directory on Windows was not being treated as a local import.