forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Font loader call json parsing fix (vercel#41052)
Stringify into one json object instead. Previously parsing would break if a string included a semicolon. ## 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
Showing
17 changed files
with
43 additions
and
37 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
4 changes: 2 additions & 2 deletions
4
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import firaCode from "@next/font/google/target.css?pages/test.tsx;Abel"; | ||
import inter from "@next/font/google/target.css?pages/test.tsx;Inter"; | ||
import firaCode from '@next/font/google/target.css?{"arguments":[],"import":"Abel","path":"pages/test.tsx"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[],"import":"Inter","path":"pages/test.tsx"}'; | ||
import React from 'react'; | ||
export { firaCode }; | ||
export { inter }; |
4 changes: 2 additions & 2 deletions
4
packages/next-swc/crates/core/tests/errors/next-font-loaders/not-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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import inter1 from '@next/font/google/target.css?pages/test.tsx;Inter;{"variant":"400"}'; | ||
import inter2 from '@next/font/google/target.css?pages/test.tsx;Inter;{"variant":"400"}'; | ||
import inter1 from '@next/font/google/target.css?{"arguments":[{"variant":"400"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
import inter2 from '@next/font/google/target.css?{"arguments":[{"variant":"400"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
var i = 10; | ||
var i2 = 20; |
8 changes: 4 additions & 4 deletions
8
packages/next-swc/crates/core/tests/errors/next-font-loaders/options-object/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
2 changes: 1 addition & 1 deletion
2
packages/next-swc/crates/core/tests/errors/next-font-loaders/spread-arg/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,2 +1,2 @@ | ||
import inter from "@next/font/google/target.css?pages/test.tsx;Inter;{};[]"; | ||
import inter from '@next/font/google/target.css?{"arguments":[{},[]],"import":"Inter","path":"pages/test.tsx"}'; | ||
const a = fn(...{}, ...[]); |
2 changes: 1 addition & 1 deletion
2
packages/next-swc/crates/core/tests/fixture/next-font-loaders/default-import/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 @@ | ||
import font from 'cool-fonts/target.css?pages/test.tsx;;{"prop":true}'; | ||
import font from 'cool-fonts/target.css?{"arguments":[{"prop":true}],"import":"","path":"pages/test.tsx"}'; |
4 changes: 2 additions & 2 deletions
4
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import firaCode from "@next/font/google/target.css?pages/test.tsx;Abel"; | ||
import inter from "@next/font/google/target.css?pages/test.tsx;Inter"; | ||
import firaCode from '@next/font/google/target.css?{"arguments":[],"import":"Abel","path":"pages/test.tsx"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[],"import":"Inter","path":"pages/test.tsx"}'; | ||
import React from 'react'; | ||
export { firaCode }; | ||
export { inter }; |
4 changes: 2 additions & 2 deletions
4
packages/next-swc/crates/core/tests/fixture/next-font-loaders/exports/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,5 +1,5 @@ | ||
import firaCode from "@next/font/google/target.css?pages/test.tsx;Abel"; | ||
import inter from "@next/font/google/target.css?pages/test.tsx;Inter"; | ||
import firaCode from '@next/font/google/target.css?{"arguments":[],"import":"Abel","path":"pages/test.tsx"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[],"import":"Inter","path":"pages/test.tsx"}'; | ||
import React from 'react'; | ||
export { firaCode }; | ||
export default inter; |
2 changes: 1 addition & 1 deletion
2
packages/next-swc/crates/core/tests/fixture/next-font-loaders/font-options/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,3 +1,3 @@ | ||
import firaCode from '@next/font/google/target.css?pages/test.tsx;Fira_Code;{"fallback":["system-ui",{"key":false},[]],"key":{"key2":{}},"preload":true,"variant":"400"}'; | ||
import firaCode from '@next/font/google/target.css?{"arguments":[{"fallback":["system-ui",{"key":false},[]],"key":{"key2":{}},"preload":true,"variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx"}'; | ||
import React from 'react'; | ||
console.log(firaCode); |
2 changes: 1 addition & 1 deletion
2
packages/next-swc/crates/core/tests/fixture/next-font-loaders/import-as/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,2 +1,2 @@ | ||
import acme1 from 'cool-fonts/target.css?pages/test.tsx;Acme;{"variant":"400"}'; | ||
import acme1 from 'cool-fonts/target.css?{"arguments":[{"variant":"400"}],"import":"Acme","path":"pages/test.tsx"}'; | ||
import React from 'react'; |
2 changes: 1 addition & 1 deletion
2
packages/next-swc/crates/core/tests/fixture/next-font-loaders/many-args/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 @@ | ||
import geo from '@next/font/google/target.css?pages/test.tsx;Geo;"test";[1.0];{"a":2.0};3.0'; | ||
import geo from '@next/font/google/target.css?{"arguments":["test",[1.0],{"a":2.0},3.0],"import":"Geo","path":"pages/test.tsx"}'; |
4 changes: 2 additions & 2 deletions
4
packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-calls/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,3 +1,3 @@ | ||
import inter from '@next/font/google/target.css?pages/test.tsx;Inter;{"display":"swap","variant":"900"}'; | ||
import inter from '@next/font/google/target.css?pages/test.tsx;Inter;{"display":"swap","variant":"900"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"900"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"900"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
import React from 'react'; |
4 changes: 2 additions & 2 deletions
4
.../next-swc/crates/core/tests/fixture/next-font-loaders/multiple-font-downloaders/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,3 +1,3 @@ | ||
import inter from '@next/font/google/target.css?pages/test.tsx;Inter;{"variant":"900"}'; | ||
import fira from 'cool-fonts/target.css?pages/test.tsx;Fira_Code;{"display":"swap","variant":"400"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[{"variant":"900"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
import fira from 'cool-fonts/target.css?{"arguments":[{"display":"swap","variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx"}'; | ||
import React from 'react'; |
4 changes: 2 additions & 2 deletions
4
packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-fonts/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,3 +1,3 @@ | ||
import firaCode from '@next/font/google/target.css?pages/test.tsx;Fira_Code;{"fallback":["system-ui"],"variant":"400"}'; | ||
import inter from '@next/font/google/target.css?pages/test.tsx;Inter;{"display":"swap","variant":"900"}'; | ||
import firaCode from '@next/font/google/target.css?{"arguments":[{"fallback":["system-ui"],"variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"900"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
import React from 'react'; |
4 changes: 2 additions & 2 deletions
4
packages/next-swc/crates/core/tests/fixture/next-font-loaders/multiple-imports/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,3 +1,3 @@ | ||
import inter from '@next/font/google/target.css?pages/test.tsx;Inter;{"variant":"900"}'; | ||
import fira from '@next/font/google/target.css?pages/test.tsx;Fira_Code;{"display":"swap","variant":"400"}'; | ||
import inter from '@next/font/google/target.css?{"arguments":[{"variant":"900"}],"import":"Inter","path":"pages/test.tsx"}'; | ||
import fira from '@next/font/google/target.css?{"arguments":[{"display":"swap","variant":"400"}],"import":"Fira_Code","path":"pages/test.tsx"}'; | ||
import React from 'react'; |
2 changes: 1 addition & 1 deletion
2
packages/next-swc/crates/core/tests/fixture/next-font-loaders/no-args/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 @@ | ||
import fira from "@next/font/google/target.css?pages/test.tsx;Fira_Code"; | ||
import fira from '@next/font/google/target.css?{"arguments":[],"import":"Fira_Code","path":"pages/test.tsx"}'; |
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