From 1f57f14fee744ec2697adc188fe9896ce8f34663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr?= <8machy@seznam.cz> Date: Fri, 12 Apr 2024 20:32:56 +0200 Subject: [PATCH] One playground is enough --- .../playground/{vanillajs => }/.gitignore | 0 .../playground/{vanillajs => }/README.md | 0 packages/bundler/playground/astro/.gitignore | 19 ------------ .../bundler/playground/astro/astro.config.js | 16 ---------- .../bundler/playground/astro/package.json | 17 ----------- packages/bundler/playground/astro/server.mjs | 26 ---------------- .../bundler/playground/astro/src/README.md | 5 ---- .../astro/src/components/title.astro | 5 ---- .../bundler/playground/astro/src/env.d.ts | 1 - .../playground/astro/src/layouts/Layout.astro | 22 -------------- .../playground/astro/src/pages/index.astro | 9 ------ .../playground/astro/src/pages/second.astro | 8 ----- .../playground/astro/src/styles/stylify.css | 1 - .../playground/astro/stylify.config.js | 7 ----- .../bundler/playground/astro/tsconfig.json | 3 -- .../bundler/playground/astro/vite.config.js | 7 ----- .../playground/{vanillajs => }/bundles.mjs | 2 +- packages/bundler/playground/nuxt/README.md | 5 ---- packages/bundler/playground/nuxt/app.vue | 5 ---- .../playground/nuxt/content/hello-world.md | 1 - .../bundler/playground/nuxt/nuxt.config.ts | 10 ------- .../bundler/playground/nuxt/stylify.config.js | 12 -------- .../playground/{vanillajs => }/package.json | 0 .../playground/{vanillajs => }/src/index.html | 0 .../{vanillajs => }/stylify.config.mjs | 2 +- packages/bundler/playground/webpack/README.md | 4 --- .../bundler/playground/webpack/index.html | 16 ---------- packages/bundler/playground/webpack/index.js | 1 - .../bundler/playground/webpack/package.json | 13 -------- .../playground/webpack/stylify.config.js | 15 ---------- .../playground/webpack/webpack.config.js | 30 ------------------- 31 files changed, 2 insertions(+), 260 deletions(-) rename packages/bundler/playground/{vanillajs => }/.gitignore (100%) rename packages/bundler/playground/{vanillajs => }/README.md (100%) delete mode 100644 packages/bundler/playground/astro/.gitignore delete mode 100644 packages/bundler/playground/astro/astro.config.js delete mode 100644 packages/bundler/playground/astro/package.json delete mode 100644 packages/bundler/playground/astro/server.mjs delete mode 100644 packages/bundler/playground/astro/src/README.md delete mode 100644 packages/bundler/playground/astro/src/components/title.astro delete mode 100644 packages/bundler/playground/astro/src/env.d.ts delete mode 100644 packages/bundler/playground/astro/src/layouts/Layout.astro delete mode 100644 packages/bundler/playground/astro/src/pages/index.astro delete mode 100644 packages/bundler/playground/astro/src/pages/second.astro delete mode 100644 packages/bundler/playground/astro/src/styles/stylify.css delete mode 100644 packages/bundler/playground/astro/stylify.config.js delete mode 100644 packages/bundler/playground/astro/tsconfig.json delete mode 100644 packages/bundler/playground/astro/vite.config.js rename packages/bundler/playground/{vanillajs => }/bundles.mjs (93%) delete mode 100644 packages/bundler/playground/nuxt/README.md delete mode 100644 packages/bundler/playground/nuxt/app.vue delete mode 100644 packages/bundler/playground/nuxt/content/hello-world.md delete mode 100644 packages/bundler/playground/nuxt/nuxt.config.ts delete mode 100644 packages/bundler/playground/nuxt/stylify.config.js rename packages/bundler/playground/{vanillajs => }/package.json (100%) rename packages/bundler/playground/{vanillajs => }/src/index.html (100%) rename packages/bundler/playground/{vanillajs => }/stylify.config.mjs (65%) delete mode 100644 packages/bundler/playground/webpack/README.md delete mode 100644 packages/bundler/playground/webpack/index.html delete mode 100644 packages/bundler/playground/webpack/index.js delete mode 100644 packages/bundler/playground/webpack/package.json delete mode 100644 packages/bundler/playground/webpack/stylify.config.js delete mode 100644 packages/bundler/playground/webpack/webpack.config.js diff --git a/packages/bundler/playground/vanillajs/.gitignore b/packages/bundler/playground/.gitignore similarity index 100% rename from packages/bundler/playground/vanillajs/.gitignore rename to packages/bundler/playground/.gitignore diff --git a/packages/bundler/playground/vanillajs/README.md b/packages/bundler/playground/README.md similarity index 100% rename from packages/bundler/playground/vanillajs/README.md rename to packages/bundler/playground/README.md diff --git a/packages/bundler/playground/astro/.gitignore b/packages/bundler/playground/astro/.gitignore deleted file mode 100644 index 02f6e50b..00000000 --- a/packages/bundler/playground/astro/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# build output -dist/ - -# dependencies -node_modules/ - -# logs -npm-debug.log* -yarn-debug.log* -yarn-error.log* -pnpm-debug.log* - - -# environment variables -.env -.env.production - -# macOS-specific files -.DS_Store diff --git a/packages/bundler/playground/astro/astro.config.js b/packages/bundler/playground/astro/astro.config.js deleted file mode 100644 index 4e9a7abb..00000000 --- a/packages/bundler/playground/astro/astro.config.js +++ /dev/null @@ -1,16 +0,0 @@ -//import node from '@astrojs/node'; -import stylify from '@stylify/astro'; - -export default { - integrations: [ - stylify({ - importDefaultBundle: false - }) - ], - //adapter: node, - //output: server, - server: { - host: '0.0.0.0', - port: 3000 - } -}; diff --git a/packages/bundler/playground/astro/package.json b/packages/bundler/playground/astro/package.json deleted file mode 100644 index 99bc557f..00000000 --- a/packages/bundler/playground/astro/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "private": true, - "type": "module", - "scripts": { - "dev": "astro dev", - "start": "astro dev", - "build": "astro build", - "preview": "astro preview", - "astro": "astro" - }, - "dependencies": { - "@astrojs/node": "^5.1.4", - "@stylify/astro": "workspace:^", - "astro": "^2.5.5", - "vite-plugin-commonjs": "^0.6.2" - } -} diff --git a/packages/bundler/playground/astro/server.mjs b/packages/bundler/playground/astro/server.mjs deleted file mode 100644 index 29d53709..00000000 --- a/packages/bundler/playground/astro/server.mjs +++ /dev/null @@ -1,26 +0,0 @@ -import { existsSync, readFileSync } from 'fs'; -import http from 'http'; -import path from 'path'; -import { handler as ssrHandler } from '../playground/dist/server/entry.mjs'; - -http.createServer((req, res) => { - ssrHandler(req, res, err => { - if (err) { - res.writeHead(500); - res.end(err.toString()); - } else { - if (req.url.endsWith('.css')) { - const filePath = path.join('dist', 'client', req.url.replace(/^\/+/, '')); - if (existsSync(filePath)) { - const content = readFileSync(filePath).toString(); - res.writeHead(200, {'Content-Type': 'text/css'}); - res.end(content, 'utf-8'); - } - return; - } - - res.writeHead(404); - res.end(); - } - }); -}).listen(3000); diff --git a/packages/bundler/playground/astro/src/README.md b/packages/bundler/playground/astro/src/README.md deleted file mode 100644 index 3df77de9..00000000 --- a/packages/bundler/playground/astro/src/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Playground usage -- Run `pnpm i` -- Then you can run `pnpm dev` for dev mode -- For production `pnpm build` && `pnpm start` -- App should be running on `http://localhost:3000` diff --git a/packages/bundler/playground/astro/src/components/title.astro b/packages/bundler/playground/astro/src/components/title.astro deleted file mode 100644 index 18f11cce..00000000 --- a/packages/bundler/playground/astro/src/components/title.astro +++ /dev/null @@ -1,5 +0,0 @@ -

Title!

diff --git a/packages/bundler/playground/astro/src/env.d.ts b/packages/bundler/playground/astro/src/env.d.ts deleted file mode 100644 index f964fe0c..00000000 --- a/packages/bundler/playground/astro/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/packages/bundler/playground/astro/src/layouts/Layout.astro b/packages/bundler/playground/astro/src/layouts/Layout.astro deleted file mode 100644 index 81dd568e..00000000 --- a/packages/bundler/playground/astro/src/layouts/Layout.astro +++ /dev/null @@ -1,22 +0,0 @@ ---- -import '/src/styles/stylify.css'; -export interface Props { - title: string; -} - -const { title } = Astro.props; ---- - - - - - - - - - {title} - - - - - diff --git a/packages/bundler/playground/astro/src/pages/index.astro b/packages/bundler/playground/astro/src/pages/index.astro deleted file mode 100644 index 18ab46a7..00000000 --- a/packages/bundler/playground/astro/src/pages/index.astro +++ /dev/null @@ -1,9 +0,0 @@ ---- -import Layout from '../layouts/Layout.astro'; -import Title from '../components/title.astro'; ---- - - - - <a href="/second">Second page</a> -</Layout> diff --git a/packages/bundler/playground/astro/src/pages/second.astro b/packages/bundler/playground/astro/src/pages/second.astro deleted file mode 100644 index 2667871f..00000000 --- a/packages/bundler/playground/astro/src/pages/second.astro +++ /dev/null @@ -1,8 +0,0 @@ ---- -import Layout from '../layouts/Layout.astro'; ---- - -<Layout title="Second Page!"> - <h1 class="color:orange">Second page!</h1> - <a href="/" class="color:red">First page</a> -</Layout> diff --git a/packages/bundler/playground/astro/src/styles/stylify.css b/packages/bundler/playground/astro/src/styles/stylify.css deleted file mode 100644 index 279a5779..00000000 --- a/packages/bundler/playground/astro/src/styles/stylify.css +++ /dev/null @@ -1 +0,0 @@ -:root {--blue: darkblue;}.a{color:blue}.b{border-bottom:24px solid red}.c{font-size:64px}.d{font-size:16px}.e{color:orange}.f{color:red} \ No newline at end of file diff --git a/packages/bundler/playground/astro/stylify.config.js b/packages/bundler/playground/astro/stylify.config.js deleted file mode 100644 index 4ba2ee4a..00000000 --- a/packages/bundler/playground/astro/stylify.config.js +++ /dev/null @@ -1,7 +0,0 @@ -export default { - compiler: { - variables: { - blue: 'darkblue' - } - } -}; diff --git a/packages/bundler/playground/astro/tsconfig.json b/packages/bundler/playground/astro/tsconfig.json deleted file mode 100644 index d78f81ec..00000000 --- a/packages/bundler/playground/astro/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "astro/tsconfigs/base" -} diff --git a/packages/bundler/playground/astro/vite.config.js b/packages/bundler/playground/astro/vite.config.js deleted file mode 100644 index e3df090f..00000000 --- a/packages/bundler/playground/astro/vite.config.js +++ /dev/null @@ -1,7 +0,0 @@ -import commonjs from 'vite-plugin-commonjs'; - -export default { - plugins: [ - commonjs() - ] -}; diff --git a/packages/bundler/playground/vanillajs/bundles.mjs b/packages/bundler/playground/bundles.mjs similarity index 93% rename from packages/bundler/playground/vanillajs/bundles.mjs rename to packages/bundler/playground/bundles.mjs index c90f9309..3c2cb219 100644 --- a/packages/bundler/playground/vanillajs/bundles.mjs +++ b/packages/bundler/playground/bundles.mjs @@ -1,5 +1,5 @@ import path from 'path'; -import { Bundler } from '../esm/index.mjs'; +import { Bundler } from './esm/index.mjs'; const watchFiles = process.argv[process.argv.length - 1] === '--w'; const outputDir = path.join('.', path.sep, 'css'); diff --git a/packages/bundler/playground/nuxt/README.md b/packages/bundler/playground/nuxt/README.md deleted file mode 100644 index f9ed4561..00000000 --- a/packages/bundler/playground/nuxt/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Playground usage -- Run `pnpm i` in above `nuxt` directory -- Then you can run `pnpm dev` for dev mode -- For production `pnpm build` && `pnpm start` -- App should be running on `http://localhost:3000` diff --git a/packages/bundler/playground/nuxt/app.vue b/packages/bundler/playground/nuxt/app.vue deleted file mode 100644 index a152ed34..00000000 --- a/packages/bundler/playground/nuxt/app.vue +++ /dev/null @@ -1,5 +0,0 @@ -<template> - <div class="font-family:arial text-align:center font-style:italic font-size:48px color:red margin-top:240px"> - <ContentDoc path="/hello-world" /> - </div> -</template> diff --git a/packages/bundler/playground/nuxt/content/hello-world.md b/packages/bundler/playground/nuxt/content/hello-world.md deleted file mode 100644 index 85f5a350..00000000 --- a/packages/bundler/playground/nuxt/content/hello-world.md +++ /dev/null @@ -1 +0,0 @@ -<div class="color:steelblue font-weight:bold">Nuxt module playground!</div> diff --git a/packages/bundler/playground/nuxt/nuxt.config.ts b/packages/bundler/playground/nuxt/nuxt.config.ts deleted file mode 100644 index 760c9ab5..00000000 --- a/packages/bundler/playground/nuxt/nuxt.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -export default { - server: { - host: '0.0.0.0', - port: '3000' - }, - modules: [ - ['@nuxt/content'], - ['../src/module.ts'] - ] -}; diff --git a/packages/bundler/playground/nuxt/stylify.config.js b/packages/bundler/playground/nuxt/stylify.config.js deleted file mode 100644 index 535a3d4f..00000000 --- a/packages/bundler/playground/nuxt/stylify.config.js +++ /dev/null @@ -1,12 +0,0 @@ -import { defineConfig } from '@stylify/unplugin'; - -export default defineConfig({ - compiler: { - variables: { - red: 'darkred' - }, - components: { - button: 'color:blue' - } - } -}); diff --git a/packages/bundler/playground/vanillajs/package.json b/packages/bundler/playground/package.json similarity index 100% rename from packages/bundler/playground/vanillajs/package.json rename to packages/bundler/playground/package.json diff --git a/packages/bundler/playground/vanillajs/src/index.html b/packages/bundler/playground/src/index.html similarity index 100% rename from packages/bundler/playground/vanillajs/src/index.html rename to packages/bundler/playground/src/index.html diff --git a/packages/bundler/playground/vanillajs/stylify.config.mjs b/packages/bundler/playground/stylify.config.mjs similarity index 65% rename from packages/bundler/playground/vanillajs/stylify.config.mjs rename to packages/bundler/playground/stylify.config.mjs index 602ad0ea..0cb59b66 100644 --- a/packages/bundler/playground/vanillajs/stylify.config.mjs +++ b/packages/bundler/playground/stylify.config.mjs @@ -1,4 +1,4 @@ -import { defineConfig } from '../esm/index.mjs'; +import { defineConfig } from './esm/index.mjs'; export default defineConfig({ compiler: { diff --git a/packages/bundler/playground/webpack/README.md b/packages/bundler/playground/webpack/README.md deleted file mode 100644 index 97ca8bb2..00000000 --- a/packages/bundler/playground/webpack/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# Playground usage -- Run `pnpm i` -- Than you can use `pnpm build` or `yarn watch` -- In case you need other unplugin then webpack, you can add it and comit it with similar default config as Webpack has. diff --git a/packages/bundler/playground/webpack/index.html b/packages/bundler/playground/webpack/index.html deleted file mode 100644 index 570115f4..00000000 --- a/packages/bundler/playground/webpack/index.html +++ /dev/null @@ -1,16 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset='utf-8' /> - <title>Getting Started - - - -
-
-

-
-
- - - diff --git a/packages/bundler/playground/webpack/index.js b/packages/bundler/playground/webpack/index.js deleted file mode 100644 index 6a9a4b13..00000000 --- a/packages/bundler/playground/webpack/index.js +++ /dev/null @@ -1 +0,0 @@ -import './index.css'; diff --git a/packages/bundler/playground/webpack/package.json b/packages/bundler/playground/webpack/package.json deleted file mode 100644 index 4e008af7..00000000 --- a/packages/bundler/playground/webpack/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "private": true, - "scripts": { - "build": "webpack build", - "watch": "webpack watch" - }, - "devDependencies": { - "webpack": "^5.65", - "webpack-cli": "^4.9", - "css-loader": "^6.5", - "style-loader": "^3.3" - } -} diff --git a/packages/bundler/playground/webpack/stylify.config.js b/packages/bundler/playground/webpack/stylify.config.js deleted file mode 100644 index 6bd88867..00000000 --- a/packages/bundler/playground/webpack/stylify.config.js +++ /dev/null @@ -1,15 +0,0 @@ -const { defineConfig } = require(__dirname + '/../../lib/index.cjs'); - -module.exports = defineConfig({ - bundles: [ - { - outputFile: './index.css', - files: ['./index.html'] - } - ], - compiler: { - variables: { - - } - } -}); diff --git a/packages/bundler/playground/webpack/webpack.config.js b/packages/bundler/playground/webpack/webpack.config.js deleted file mode 100644 index bd54b0bd..00000000 --- a/packages/bundler/playground/webpack/webpack.config.js +++ /dev/null @@ -1,30 +0,0 @@ -const path = require('path'); -const { stylifyWebpack } = require('../../lib/index.cjs'); - -module.exports = { - entry: path.join(__dirname, 'index.js'), - module: { - rules: [ - { - test: /\.css$/i, - use: ['style-loader', 'css-loader'] - } - ] - }, - plugins: [ - stylifyWebpack({ - bundles: [{ - files: [__dirname + '/index.html'], - outputFile: __dirname + '/index.css' - }] - }) - ], - - mode: 'development', - - output: { - path: path.join(__dirname), - filename: 'main.js', - libraryTarget: 'umd' - } -};