-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3edde44
commit 0c815de
Showing
50 changed files
with
960 additions
and
111 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as styles from './features.css'; | ||
import testNodes from '../test-nodes.json'; | ||
|
||
export default ` | ||
<div id="${testNodes.mergedStyle}" class="${styles.mergedStyle}">Merged style</div> | ||
<div id="${testNodes.styleWithComposition}" class="${styles.styleWithComposition}">Style with composition</div> | ||
<div id="${testNodes.styleVariantsWithComposition}" class="${styles.styleVariantsWithComposition.variant}">Style variants with composition</div> | ||
<div id="${testNodes.styleVariantsWithMappedComposition}" class="${styles.styleVariantsWithMappedComposition.variant}">Style variants with mapped composition</div> | ||
<div id="${testNodes.compositionOnly}" class="${styles.compositionOnly}">Composition only</div> | ||
<div id="${testNodes.styleCompositionInSelector}" class="${styles.styleCompositionInSelector}">Style composition in selector</div> | ||
<div id="${testNodes.styleVariantsCompositionInSelector}" class="${styles.styleVariantsCompositionInSelector.variant}">Style variants composition in selector</div> | ||
`; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const path = require('path'); | ||
const { cpSync, existsSync } = require('fs'); | ||
|
||
// Copy next plugin dist files. | ||
// This is a workaround to prevent @vanilla-extract/next-plugin | ||
// resolving to next 12 peer dependency | ||
const main = () => { | ||
const nextPluginDir = path.dirname( | ||
require.resolve('@vanilla-extract/next-plugin/package.json'), | ||
); | ||
|
||
const nextPluginDistDir = path.join(nextPluginDir, 'dist'); | ||
|
||
if (!existsSync(nextPluginDistDir)) { | ||
throw new Error('@vanilla-extract/next-plugin dist is missing.'); | ||
} | ||
|
||
cpSync(nextPluginDistDir, path.join(process.cwd(), 'next-plugin', 'dist'), { | ||
recursive: true, | ||
}); | ||
}; | ||
|
||
main(); |
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,6 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
/// <reference types="next/navigation-types/compat/navigation" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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,24 @@ | ||
const { | ||
createVanillaExtractPlugin, | ||
} = require('./next-plugin/dist/vanilla-extract-next-plugin.cjs.js'); | ||
|
||
const withVanillaExtract = createVanillaExtractPlugin(); | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const config = withVanillaExtract({ | ||
// exporting a static build for next 13 | ||
// due to issues with distDir on next custom server | ||
output: 'export', | ||
// we need to differentiate build and dev folders | ||
// so they don't overwrite eachother when running tests | ||
distDir: process.env.NODE_ENV === 'production' ? 'dist' : '.next', | ||
experimental: { | ||
externalDir: true, | ||
}, | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60, | ||
}, | ||
}); | ||
|
||
module.exports = config; |
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,38 @@ | ||
{ | ||
"name": "@fixtures/next-app-router", | ||
"description": "Next app router fixtures", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "pnpm copy-next-plugin && next dev", | ||
"build": "pnpm copy-next-plugin && next build", | ||
"start": "next start", | ||
"clean-build": "pnpm clean && pnpm build", | ||
"copy-next-plugin": "node ./copyNextPlugin.cjs", | ||
"clean": "pnpm clean:dev && pnpm clean:prod", | ||
"clean:dev": "rm -rf .next", | ||
"clean:prod": "rm -rf dist" | ||
}, | ||
"dependencies": { | ||
"@fixtures/features": "*", | ||
"@fixtures/recipes": "*", | ||
"@fixtures/sprinkles": "*", | ||
"@vanilla-extract/css": "*", | ||
"@vanilla-extract/recipes": "*", | ||
"@vanilla-extract/sprinkles": "*", | ||
"next": "npm:[email protected]", | ||
"react": "npm:react@^18.2.0", | ||
"react-dom": "npm:react-dom@^18.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^17", | ||
"@vanilla-extract/next-plugin": "*", | ||
"@vanilla-extract/webpack-plugin": "*" | ||
}, | ||
"browserslist": [ | ||
">0.3%", | ||
"ie 11", | ||
"safari 4", | ||
"not op_mini all" | ||
] | ||
} |
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,10 @@ | ||
import html from '@fixtures/features/src/html'; | ||
|
||
export default function Features() { | ||
return ( | ||
<> | ||
<span id="features" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,11 @@ | ||
export default function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<html lang="en"> | ||
<body>{children}</body> | ||
</html> | ||
); | ||
} |
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,13 @@ | ||
import Link from 'next/link'; | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<Link href="/sprinkles">sprinkles</Link> | ||
<br /> | ||
<Link href="/recipes">recipes</Link> | ||
<br /> | ||
<Link href="/features">features</Link> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/recipes/src/html'; | ||
|
||
export default function Recipes() { | ||
return ( | ||
<> | ||
<span id="recipes" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/sprinkles/src/html'; | ||
|
||
export default function Sprinkles() { | ||
return ( | ||
<> | ||
<span id="sprinkles" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,21 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"forceConsistentCasingInFileNames": true, | ||
"jsx": "preserve", | ||
"plugins": [ | ||
{ | ||
"name": "next" | ||
} | ||
], | ||
"strictNullChecks": true | ||
}, | ||
"include": [ | ||
"next-env.d.ts", | ||
"**/*.ts", | ||
"**/*.tsx", | ||
".next/types/**/*.ts", | ||
"dist/types/**/*.ts" | ||
], | ||
"exclude": ["node_modules"] | ||
} |
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 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
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,19 @@ | ||
const { createVanillaExtractPlugin } = require('@vanilla-extract/next-plugin'); | ||
|
||
const withVanillaExtract = createVanillaExtractPlugin(); | ||
|
||
/** @type {import('next').NextConfig} */ | ||
const config = withVanillaExtract({ | ||
// we need to differentiate build and dev folders | ||
// so they don't overwrite eachother when running tests | ||
distDir: process.env.NODE_ENV === 'production' ? 'dist' : '.next', | ||
experimental: { | ||
externalDir: true, | ||
}, | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60, | ||
}, | ||
}); | ||
|
||
module.exports = config; |
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,36 @@ | ||
{ | ||
"name": "@fixtures/next-pages-router", | ||
"description": "Next pages router fixtures", | ||
"version": "0.0.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"clean-build": "pnpm clean && next build", | ||
"clean": "pnpm clean:dev && pnpm clean:prod", | ||
"clean:dev": "rm -rf .next", | ||
"clean:prod": "rm -rf dist" | ||
}, | ||
"dependencies": { | ||
"@fixtures/features": "*", | ||
"@fixtures/recipes": "*", | ||
"@fixtures/sprinkles": "*", | ||
"@vanilla-extract/css": "*", | ||
"@vanilla-extract/recipes": "*", | ||
"@vanilla-extract/sprinkles": "*", | ||
"next": "12.3.4", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"devDependencies": { | ||
"@types/react": "^17", | ||
"@vanilla-extract/next-plugin": "2.3.2" | ||
}, | ||
"browserslist": [ | ||
">0.3%", | ||
"ie 11", | ||
"safari 4", | ||
"not op_mini all" | ||
] | ||
} |
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,10 @@ | ||
import html from '@fixtures/features/src/html'; | ||
|
||
export default function Features() { | ||
return ( | ||
<> | ||
<span id="features" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,13 @@ | ||
import Link from 'next/link'; | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<Link href="/sprinkles">sprinkles</Link> | ||
<br /> | ||
<Link href="/recipes">recipes</Link> | ||
<br /> | ||
<Link href="/features">features</Link> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/recipes/src/html'; | ||
|
||
export default function Recipes() { | ||
return ( | ||
<> | ||
<span id="recipes" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
import html from '@fixtures/sprinkles/src/html'; | ||
|
||
export default function Sprinkles() { | ||
return ( | ||
<> | ||
<span id="sprinkles" /> | ||
<div dangerouslySetInnerHTML={{ __html: html }} /> | ||
</> | ||
); | ||
} |
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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"forceConsistentCasingInFileNames": true, | ||
"jsx": "preserve", | ||
"strictNullChecks": true | ||
}, | ||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], | ||
"exclude": ["node_modules"] | ||
} |
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,20 @@ | ||
import { button, stack } from './styles.css'; | ||
|
||
export default `<div class="${stack()}"> | ||
<button class="${button()}"> | ||
Standard calm button | ||
</button> | ||
<button class="${button({ size: 'small' })}"> | ||
Small calm button | ||
</button> | ||
<button class="${button({ tone: 'angry' })}"> | ||
Standard angry button | ||
</button> | ||
<button class="${button({ | ||
size: 'small', | ||
tone: 'angry', | ||
bold: true, | ||
})}"> | ||
Small angry button | ||
</button> | ||
</div>`; |
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,26 +1,7 @@ | ||
import { button, stack } from './styles.css'; | ||
import html from './html'; | ||
|
||
function render() { | ||
document.body.innerHTML = ` | ||
<div class="${stack()}"> | ||
<button class="${button()}"> | ||
Standard calm button | ||
</button> | ||
<button class="${button({ size: 'small' })}"> | ||
Small calm button | ||
</button> | ||
<button class="${button({ tone: 'angry' })}"> | ||
Standard angry button | ||
</button> | ||
<button class="${button({ | ||
size: 'small', | ||
tone: 'angry', | ||
bold: true, | ||
})}"> | ||
Small angry button | ||
</button> | ||
</div> | ||
`; | ||
document.body.innerHTML = html; | ||
} | ||
|
||
render(); |
Oops, something went wrong.