Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions packages/next-swc/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions packages/next-swc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ swc_emotion = { version = "0.29.10" }
testing = { version = "0.31.31" }

# Turbo crates
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230405.4" }
turbo-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230406.2" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230405.4" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230406.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230405.4" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230406.2" }

# General Deps

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_ENV=".env"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_ENV_DEV=".env.development"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_ENV_LOCAL = .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_ENV_PROD=".env.production"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { useEffect } from 'react'

export default function Home() {
useEffect(() => {
// Only run on client
import('@turbo/pack-test-harness').then(runTests)
})

const pub = Object.fromEntries(
Object.entries(process.env)
.filter(([key]) => key.startsWith('NEXT_PUBLIC_'))
.sort((a, b) => a[0].localeCompare(b[0]))
)

return JSON.stringify(pub)
}

function runTests() {
it('should have access to ENV on server', function () {
const json = JSON.parse(document.body.innerText)
expect(json).toMatchObject({
NEXT_PUBLIC_ENV: '.env',
NEXT_PUBLIC_ENV_DEV: '.env.development',
NEXT_PUBLIC_ENV_LOCAL: '.env.local',
})
})

it('should expose NEXT_PUBLIC_ ENV on client', function () {
expect(process.env).toMatchObject({
NEXT_PUBLIC_ENV: '.env',
NEXT_PUBLIC_ENV_DEV: '.env.development',
NEXT_PUBLIC_ENV_LOCAL: '.env.local',
})
})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_FOO=foo bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { useEffect } from 'react'

export default function Home() {
useEffect(() => {
// Only run on client
import('@turbo/pack-test-harness').then(runTests)
})

const pub = Object.fromEntries(
Object.entries(process.env)
.filter(([key]) => key.startsWith('NEXT_PUBLIC_'))
.sort((a, b) => a[0].localeCompare(b[0]))
)

return JSON.stringify(pub)
}

function runTests() {
it('test', function () {})
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/env/parse-error/input/.env",
category: "parse",
title: "Error loading dotenv file",
description: "Error parsing line: 'foo bar', error at line index: 4",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[
PlainIssueProcessingPathItem {
context: None,
description: "Next.js Routing for GET /_next/static/chunks/e2911_@swc_helpers_lib__interop_require_default_0b72a2.js",
},
],
),
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
PlainIssue {
severity: Error,
context: "[project]/packages/next-swc/crates/next-dev-tests/tests/integration/next/env/parse-error/input/.env",
category: "parse",
title: "Error loading dotenv file",
description: "Error parsing line: 'foo bar', error at line index: 4",
detail: "",
documentation_link: "",
source: None,
sub_issues: [],
processing_path: Some(
[
PlainIssueProcessingPathItem {
context: None,
description: "Next.js Routing for GET /_next/static/chunks/b41af_react_684c14._.js",
},
],
),
}
Loading