Skip to content

refactor: extract edge runtime shims into separate file #1916

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

Merged
merged 2 commits into from
Feb 3, 2023

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Feb 2, 2023

Summary

We provide a number of shims and polyfills to make our edge runtime work with Next.js. Currently they're a big string in a helper file. This PR extracts them into a file, meaning they can be properly typechecked.

Test plan

This should have no effect on the output.

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

image

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@ascorbic ascorbic requested a review from a team February 2, 2023 13:35
@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/63dbc0f971fd6200080b1aec
😎 Deploy Preview https://deploy-preview-1916--netlify-plugin-nextjs-static-root-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for netlify-plugin-nextjs-export-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/63dbc0f98e2c750008cf3026
😎 Deploy Preview https://deploy-preview-1916--netlify-plugin-nextjs-export-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for next-plugin-canary ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-canary/deploys/63dbc0f98e2c750008cf302b
😎 Deploy Preview https://deploy-preview-1916--next-plugin-canary.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/63dbc0f977c367000848585b
😎 Deploy Preview https://deploy-preview-1916--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for netlify-plugin-nextjs-next-auth-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-next-auth-demo/deploys/63dbc0f912fab1000874d875
😎 Deploy Preview https://deploy-preview-1916--netlify-plugin-nextjs-next-auth-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for next-plugin-edge-middleware ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/next-plugin-edge-middleware/deploys/63dbc0f9084e05000889a830
😎 Deploy Preview https://deploy-preview-1916--next-plugin-edge-middleware.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for nextjs-plugin-custom-routes-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/nextjs-plugin-custom-routes-demo/deploys/63dbc0f95242f60008c8598b
😎 Deploy Preview https://deploy-preview-1916--nextjs-plugin-custom-routes-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for next-i18next-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/next-i18next-demo/deploys/63dbc0f913193c00080b7d14
😎 Deploy Preview https://deploy-preview-1916--next-i18next-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@netlify
Copy link

netlify bot commented Feb 2, 2023

Deploy Preview for netlify-plugin-nextjs-demo ready!

Name Link
🔨 Latest commit ba29db0
🔍 Latest deploy log https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/63dbc0fa6c401600071f5b13
😎 Deploy Preview https://deploy-preview-1916--netlify-plugin-nextjs-demo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹

@@ -4,7 +4,7 @@ import { resolve, join } from 'path'
import type { NetlifyConfig, NetlifyPluginConstants } from '@netlify/build'
import { greenBright } from 'chalk'
import destr from 'destr'
import { copy, copyFile, emptyDir, ensureDir, readJSON, readJson, writeJSON, writeJson } from 'fs-extra'
import { copy, copyFile, emptyDir, ensureDir, readJSON, writeJSON, writeJson } from 'fs-extra'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just notice there’s the same function name twice in fs-extra but with different casings. Odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that it's a legacy thing. Confusing, as I'm not sure which is "preferred"

@MarcL
Copy link
Contributor

MarcL commented Feb 2, 2023

Could we add tests for the function's code now? Worth doing that?

@nickytonline
Copy link

Could we add tests for the function's code now? Worth doing that?

I believe the snapshot should handle that?

@ascorbic
Copy link
Contributor Author

ascorbic commented Feb 3, 2023

Yeah, these are all comprehensively tested elsewhere.

@kodiakhq kodiakhq bot merged commit 846540b into main Feb 3, 2023
@kodiakhq kodiakhq bot deleted the mk/extract-shims branch February 3, 2023 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants