-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow export const in font loader (#40836)
Allow `export const font = Font()` syntax ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have a helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have a helpful link attached, see `contributing.md` ## Documentation / Examples - [ ] Make sure the linting passes by running `pnpm lint` - [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
- Loading branch information
Hannes Bornö
authored
Sep 23, 2022
1 parent
2e02204
commit 719116a
Showing
9 changed files
with
81 additions
and
11 deletions.
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
5 changes: 5 additions & 0 deletions
5
packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/input.js
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
import { Abel, Inter } from '@next/font/google' | ||
|
||
export let firaCode = Abel() | ||
export var inter = Inter() |
5 changes: 5 additions & 0 deletions
5
packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/output.js
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import firaCode from "@next/font/google?pages/test.tsx;Abel"; | ||
import inter from "@next/font/google?pages/test.tsx;Inter"; | ||
import React from 'react'; | ||
export { firaCode }; | ||
export { inter }; |
12 changes: 12 additions & 0 deletions
12
packages/next-swc/crates/core/tests/errors/next-font-loaders/export-let/output.stderr
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
x Font loader calls must be assigned to a const | ||
,-[input.js:4:1] | ||
4 | export let firaCode = Abel() | ||
: ^^^^^^^^^^^^^^^^^^^^^ | ||
`---- | ||
|
||
x Font loader calls must be assigned to a const | ||
,-[input.js:5:1] | ||
5 | export var inter = Inter() | ||
: ^^^^^^^^^^^^^^^^^^^ | ||
`---- |
6 changes: 6 additions & 0 deletions
6
packages/next-swc/crates/core/tests/errors/next-font-loaders/not-ident/output.js
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 +1,7 @@ | ||
const { a } = Inter({ | ||
variant: '400' | ||
}); | ||
const [b] = Inter({ | ||
variant: '400' | ||
}); | ||
const { e } = {}; |
5 changes: 5 additions & 0 deletions
5
packages/next-swc/crates/core/tests/fixture/next-font-loaders/export-const/input.js
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
import { Abel, Inter } from '@next/font/google' | ||
|
||
export const firaCode = Abel() | ||
export const inter = Inter() |
5 changes: 5 additions & 0 deletions
5
packages/next-swc/crates/core/tests/fixture/next-font-loaders/export-const/output.js
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import firaCode from "@next/font/google?pages/test.tsx;Abel"; | ||
import inter from "@next/font/google?pages/test.tsx;Inter"; | ||
import React from 'react'; | ||
export { firaCode }; | ||
export { inter }; |
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