├── .babelrc ├── .github └── FUNDING.yml ├── .gitignore ├── .npmignore ├── .travis.yml ├── LICENSE.md ├── README.md ├── examples └── nextjs │ ├── .babelrc │ ├── .gitignore │ ├── README.md │ ├── components │ └── StitchesLogo.tsx │ ├── next-env.d.ts │ ├── package.json │ ├── pages │ ├── _document.tsx │ └── index.tsx │ ├── public │ └── favicon.ico │ ├── stitches.config.ts │ ├── tsconfig.json │ └── yarn.lock ├── package-lock.json ├── package.json ├── src └── index.js └── test ├── fixtures └── display-name │ ├── .babelrc │ ├── assignment-expression │ ├── input.js │ └── output.js │ ├── export-default │ ├── input.js │ └── output.js │ ├── nested │ ├── input.js │ └── output.js │ ├── object-property │ ├── input.js │ └── output.js │ └── variable-declarator │ ├── input.js │ └── output.js └── index.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/preset-env"] 3 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: afzalsayed96 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | lib 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.log 3 | src 4 | examples 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.12" 4 | - "iojs" 5 | - v4 6 | - v5 7 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2020-present Afzal Sayed 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # babel-plugin-transform-stitches-display-name 2 | 3 |

4 | 5 | 6 | 7 | Ceasefire Now 8 |

9 | Babel plugin to add displayName to your styled component 10 | 11 | ## Input 12 | 13 | ```js 14 | let foo = styled('div', {}); 15 | ``` 16 | 17 | ## Output 18 | 19 | ```js 20 | let foo = Object.assign({}, styled('div', {}), { 21 | displayName: "foo" 22 | }); 23 | 24 | ``` 25 | 26 | ## Installation 27 | 28 | ```sh 29 | $ npm install babel-plugin-transform-stitches-display-name 30 | ``` 31 | 32 | ## Usage 33 | 34 | ### Via `.babelrc` (Recommended) 35 | 36 | **.babelrc** 37 | 38 | ```json 39 | { 40 | "plugins": ["transform-stitches-display-name"] 41 | } 42 | ``` 43 | 44 | ### Via CLI 45 | 46 | ```sh 47 | $ babel --plugins transform-stitches-display-name script.js 48 | ``` 49 | 50 | ### Via Node API 51 | 52 | ```javascript 53 | require("@babel/core").transform("code", { 54 | plugins: ["transform-stitches-display-name"], 55 | }); 56 | ``` 57 | 58 | ## Acknowledgements 59 | 60 | This plugin is adapted from [@babel/plugin-transform-react-display-name](https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-react-display-name) many thanks to the Babel team. 61 | -------------------------------------------------------------------------------- /examples/nextjs/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["next/babel"], 3 | "plugins": ["babel-plugin-transform-stitches-display-name"] 4 | } -------------------------------------------------------------------------------- /examples/nextjs/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | -------------------------------------------------------------------------------- /examples/nextjs/README.md: -------------------------------------------------------------------------------- 1 | # Stitches Example 2 | 3 | This example shows how to use the [Stitches CSS-in-JS Library](https://github.com/modulz/stitches). 4 | 5 | ## Deploy your own 6 | 7 | Deploy the example using [Vercel](https://vercel.com): 8 | 9 | [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-stitches) 10 | 11 | ## How to use 12 | 13 | Execute [Create Next App](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example: 14 | 15 | ```bash 16 | npx create-next-app --example with-stitches 17 | # or 18 | yarn create next-app --example with-stitches 19 | ``` 20 | 21 | Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)). 22 | -------------------------------------------------------------------------------- /examples/nextjs/components/StitchesLogo.tsx: -------------------------------------------------------------------------------- 1 | const StitchesLogo = () => ( 2 | 9 | 16 | 17 | 18 | 24 | 29 | 35 | 41 | 47 | 48 | ) 49 | 50 | export default StitchesLogo 51 | -------------------------------------------------------------------------------- /examples/nextjs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | 4 | // NOTE: This file should not be edited 5 | // see https://nextjs.org/docs/basic-features/typescript for more information. 6 | -------------------------------------------------------------------------------- /examples/nextjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "with-stitches", 3 | "version": "0.1.0", 4 | "scripts": { 5 | "dev": "next dev", 6 | "build": "next build", 7 | "start": "next start" 8 | }, 9 | "dependencies": { 10 | "@stitches/react": "latest", 11 | "babel-plugin-transform-stitches-display-name": "../../", 12 | "next": "latest", 13 | "react": "latest", 14 | "react-dom": "latest" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^14.11.8", 18 | "@types/react": "^16.9.43", 19 | "typescript": "^3.9.7" 20 | }, 21 | "license": "MIT" 22 | } 23 | -------------------------------------------------------------------------------- /examples/nextjs/pages/_document.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import NextDocument, { Html, Head, Main, NextScript } from 'next/document'; 3 | import { getCssText } from '../stitches.config'; 4 | 5 | export default class Document extends NextDocument { 6 | render() { 7 | return ( 8 | 9 | 10 |