Skip to content

Commit

Permalink
Merge branch 'canary' into add/rename-page-entry
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] committed Aug 12, 2022
2 parents cf87e66 + 6ff05b6 commit feeea1f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 19 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -1472,13 +1472,13 @@ jobs:
# Disable LTO, or the lld may crash with OOM
CARGO_PROFILE_RELEASE_LTO: false
with:
envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS CARGO_PROFILE_RELEASE_LTO NAPI_CLI_VERSION TURBO_VERSION RUST_TOOLCHAIN
envs: DEBUG RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS CARGO_PROFILE_RELEASE_LTO NAPI_CLI_VERSION TURBO_VERSION RUST_TOOLCHAIN PNPM_VERSION
usesh: true
mem: 6000
prepare: |
pkg install -y curl node14
pkg install -y curl node16
curl -qL https://www.npmjs.com/install.sh | sh
npm install -g yarn
npm i -g pnpm@${PNPM_VERSION} "@napi-rs/cli@${NAPI_CLI_VERSION}"
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
export PATH="/usr/local/cargo/bin:$PATH"
Expand All @@ -1493,8 +1493,7 @@ jobs:
whoami
env
freebsd-version
npm i -g "@napi-rs/cli@${NAPI_CLI_VERSION}"
cd packages/next-swc && napi build --platform -p next-swc-napi --cargo-name next_swc_napi native --release --target x86_64-unknown-freebsd
pnpm --filter=@next/swc run build-native-no-plugin --platform --release --target x86_64-unknown-freebsd
rm -rf node_modules
rm -rf packages/next-swc/target
- name: Upload artifact
Expand Down
45 changes: 31 additions & 14 deletions packages/next/pages/_document.tsx
Expand Up @@ -46,9 +46,10 @@ function getDocumentFiles(
inAmpMode: boolean
): DocumentFiles {
const sharedFiles: readonly string[] = getPageFiles(buildManifest, '/_app')
const pageFiles: readonly string[] = inAmpMode
? []
: getPageFiles(buildManifest, pathname)
const pageFiles: readonly string[] =
process.env.NEXT_RUNTIME !== 'edge' && inAmpMode
? []
: getPageFiles(buildManifest, pathname)

return {
sharedFiles,
Expand Down Expand Up @@ -434,7 +435,11 @@ export class Head extends Component<HeadProps> {
)
}

if (process.env.NODE_ENV !== 'development' && optimizeFonts && !inAmpMode) {
if (
process.env.NODE_ENV !== 'development' &&
optimizeFonts &&
!(process.env.NEXT_RUNTIME !== 'edge' && inAmpMode)
) {
children = this.makeStylesheetInert(children)
}

Expand All @@ -445,7 +450,7 @@ export class Head extends Component<HeadProps> {
head = React.Children.map(head || [], (child) => {
if (!child) return child
const { type, props } = child
if (inAmpMode) {
if (process.env.NEXT_RUNTIME !== 'edge' && inAmpMode) {
let badProp: string = ''

if (type === 'meta' && props.name === 'viewport') {
Expand Down Expand Up @@ -488,7 +493,7 @@ export class Head extends Component<HeadProps> {
const files: DocumentFiles = getDocumentFiles(
this.context.buildManifest,
this.context.__NEXT_DATA__.page,
inAmpMode
process.env.NEXT_RUNTIME !== 'edge' && inAmpMode
)

return (
Expand All @@ -497,14 +502,22 @@ export class Head extends Component<HeadProps> {
<>
<style
data-next-hide-fouc
data-ampdevmode={inAmpMode ? 'true' : undefined}
data-ampdevmode={
process.env.NEXT_RUNTIME !== 'edge' && inAmpMode
? 'true'
: undefined
}
dangerouslySetInnerHTML={{
__html: `body{display:none}`,
}}
/>
<noscript
data-next-hide-fouc
data-ampdevmode={inAmpMode ? 'true' : undefined}
data-ampdevmode={
process.env.NEXT_RUNTIME !== 'edge' && inAmpMode
? 'true'
: undefined
}
>
<style
dangerouslySetInnerHTML={{
Expand All @@ -523,7 +536,7 @@ export class Head extends Component<HeadProps> {
{children}
{optimizeFonts && <meta name="next-font-preconnect" />}

{inAmpMode && (
{process.env.NEXT_RUNTIME !== 'edge' && inAmpMode && (
<>
<meta
name="viewport"
Expand Down Expand Up @@ -559,7 +572,7 @@ export class Head extends Component<HeadProps> {
<script async src="https://cdn.ampproject.org/v0.js" />
</>
)}
{!inAmpMode && (
{!(process.env.NEXT_RUNTIME !== 'edge' && inAmpMode) && (
<>
{!hasAmphtmlRel && hybridAmp && (
<link
Expand Down Expand Up @@ -938,7 +951,7 @@ export class NextScript extends Component<OriginProps> {

docComponentsRendered.NextScript = true

if (inAmpMode) {
if (process.env.NEXT_RUNTIME !== 'edge' && inAmpMode) {
if (process.env.NODE_ENV === 'production') {
return null
}
Expand Down Expand Up @@ -985,7 +998,7 @@ export class NextScript extends Component<OriginProps> {
const files: DocumentFiles = getDocumentFiles(
this.context.buildManifest,
this.context.__NEXT_DATA__.page,
inAmpMode
process.env.NEXT_RUNTIME !== 'edge' && inAmpMode
)

return (
Expand Down Expand Up @@ -1091,9 +1104,13 @@ export function Html(
<html
{...props}
lang={props.lang || locale || undefined}
amp={inAmpMode ? '' : undefined}
amp={process.env.NEXT_RUNTIME !== 'edge' && inAmpMode ? '' : undefined}
data-ampdevmode={
inAmpMode && process.env.NODE_ENV !== 'production' ? '' : undefined
process.env.NEXT_RUNTIME !== 'edge' &&
inAmpMode &&
process.env.NODE_ENV !== 'production'
? ''
: undefined
}
/>
)
Expand Down

0 comments on commit feeea1f

Please sign in to comment.