diff --git a/CHANGELOG.md b/CHANGELOG.md index 6486eef5..df418c3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + + +### Features + +* 🎸 css scramble plugin ([#85](https://github.com/mjancarik/merkur/issues/85)) ([bfeff1e](https://github.com/mjancarik/merkur/commit/bfeff1ef15009ff9cf7dc81564af573526042a7a)) + + + + + # [0.24.0](https://github.com/mjancarik/merkur/compare/v0.23.12...v0.24.0) (2021-05-28) diff --git a/lerna.json b/lerna.json index 180920d7..2463ee95 100644 --- a/lerna.json +++ b/lerna.json @@ -11,5 +11,5 @@ "packages": [ "packages/*" ], - "version": "0.24.0" + "version": "0.24.1" } diff --git a/packages/core/CHANGELOG.md b/packages/core/CHANGELOG.md index 0248e6b5..407e3c1b 100644 --- a/packages/core/CHANGELOG.md +++ b/packages/core/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + +**Note:** Version bump only for package @merkur/core + + + + + # [0.24.0](https://github.com/mjancarik/merkur/compare/v0.23.12...v0.24.0) (2021-05-28) **Note:** Version bump only for package @merkur/core diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json index 7cb81b0f..69958803 100644 --- a/packages/core/package-lock.json +++ b/packages/core/package-lock.json @@ -1,6 +1,6 @@ { "name": "@merkur/core", - "version": "0.24.0", + "version": "0.24.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/core/package.json b/packages/core/package.json index aca42f2c..d542ef3b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@merkur/core", - "version": "0.24.0", + "version": "0.24.1", "description": "Merkur is tiny and extensible library for creating front-end microservices.", "main": "lib/index", "module": "lib/index", diff --git a/packages/create-widget/CHANGELOG.md b/packages/create-widget/CHANGELOG.md index 294d25a1..f7e26d1f 100644 --- a/packages/create-widget/CHANGELOG.md +++ b/packages/create-widget/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + +**Note:** Version bump only for package @merkur/create-widget + + + + + # [0.24.0](https://github.com/mjancarik/merkur/compare/v0.23.12...v0.24.0) (2021-05-28) diff --git a/packages/create-widget/package-lock.json b/packages/create-widget/package-lock.json index cc783d79..1bab3117 100644 --- a/packages/create-widget/package-lock.json +++ b/packages/create-widget/package-lock.json @@ -1,6 +1,6 @@ { "name": "@merkur/create-widget", - "version": "0.24.0", + "version": "0.24.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/create-widget/package.json b/packages/create-widget/package.json index c08acc41..d603b813 100644 --- a/packages/create-widget/package.json +++ b/packages/create-widget/package.json @@ -1,6 +1,6 @@ { "name": "@merkur/create-widget", - "version": "0.24.0", + "version": "0.24.1", "description": "CLI for creating merkur widget easily.", "bin": { "merkur-create-widget": "./bin/createWidget.js" diff --git a/packages/create-widget/template/package.json b/packages/create-widget/template/package.json index 8e05f9d7..0bf8b352 100644 --- a/packages/create-widget/template/package.json +++ b/packages/create-widget/template/package.json @@ -17,11 +17,11 @@ "author": "", "license": "ISC", "dependencies": { - "@merkur/core": "0.24.0", - "@merkur/integration": "0.24.0", - "@merkur/plugin-component": "0.24.0", - "@merkur/plugin-error": "0.24.0", - "@merkur/plugin-event-emitter": "0.24.0", + "@merkur/core": "0.24.1", + "@merkur/integration": "0.24.1", + "@merkur/plugin-component": "0.24.1", + "@merkur/plugin-error": "0.24.1", + "@merkur/plugin-event-emitter": "0.24.1", "compression": "^1.7.4", "config": "^3.3.6", "cors": "^2.8.5", @@ -34,7 +34,7 @@ "morgan": "^1.10.0" }, "devDependencies": { - "@merkur/tools": "0.24.0", + "@merkur/tools": "0.24.1", "nodemon": "^2.0.7", "webpack": "^5.33.2", "webpack-cli": "^4.6.0" diff --git a/packages/integration-react/CHANGELOG.md b/packages/integration-react/CHANGELOG.md index 49aa94cf..cdc44bf1 100644 --- a/packages/integration-react/CHANGELOG.md +++ b/packages/integration-react/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + +**Note:** Version bump only for package @merkur/integration-react + + + + + # [0.24.0](https://github.com/mjancarik/merkur/compare/v0.23.12...v0.24.0) (2021-05-28) diff --git a/packages/integration-react/package-lock.json b/packages/integration-react/package-lock.json index 92896bec..beed6e0b 100644 --- a/packages/integration-react/package-lock.json +++ b/packages/integration-react/package-lock.json @@ -1,6 +1,6 @@ { "name": "@merkur/integration-react", - "version": "0.24.0", + "version": "0.24.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/integration-react/package.json b/packages/integration-react/package.json index d2def6ff..8a1ce88c 100644 --- a/packages/integration-react/package.json +++ b/packages/integration-react/package.json @@ -1,6 +1,6 @@ { "name": "@merkur/integration-react", - "version": "0.24.0", + "version": "0.24.1", "description": "Merkur module for easy integration with react.", "main": "lib/index", "module": "lib/index", @@ -42,9 +42,9 @@ "homepage": "https://merkur.js.org/", "devDependencies": { "@babel/preset-react": "^7.13.13", - "@merkur/core": "^0.24.0", - "@merkur/plugin-component": "^0.24.0", - "@merkur/plugin-event-emitter": "^0.24.0", + "@merkur/core": "^0.24.1", + "@merkur/plugin-component": "^0.24.1", + "@merkur/plugin-event-emitter": "^0.24.1", "enzyme": "3.11.0", "enzyme-adapter-react-16": "1.15.6", "enzyme-to-json": "^3.6.2", @@ -58,6 +58,6 @@ "react-dom": ">=16" }, "dependencies": { - "@merkur/integration": "^0.24.0" + "@merkur/integration": "^0.24.1" } } diff --git a/packages/integration/CHANGELOG.md b/packages/integration/CHANGELOG.md index e15362c1..21271096 100644 --- a/packages/integration/CHANGELOG.md +++ b/packages/integration/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + +**Note:** Version bump only for package @merkur/integration + + + + + # [0.24.0](https://github.com/mjancarik/merkur/compare/v0.23.12...v0.24.0) (2021-05-28) **Note:** Version bump only for package @merkur/integration diff --git a/packages/integration/package-lock.json b/packages/integration/package-lock.json index a2b21b4e..3d524f57 100644 --- a/packages/integration/package-lock.json +++ b/packages/integration/package-lock.json @@ -1,6 +1,6 @@ { "name": "@merkur/integration", - "version": "0.24.0", + "version": "0.24.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/integration/package.json b/packages/integration/package.json index b50084bb..e7a1ecc8 100644 --- a/packages/integration/package.json +++ b/packages/integration/package.json @@ -1,6 +1,6 @@ { "name": "@merkur/integration", - "version": "0.24.0", + "version": "0.24.1", "description": "Merkur module for easy integration with other apps.", "main": "lib/index", "module": "lib/index", @@ -45,7 +45,7 @@ }, "homepage": "https://merkur.js.org/", "devDependencies": { - "@merkur/core": "^0.24.0", + "@merkur/core": "^0.24.1", "rollup": "^2.51.0" }, "peerDependencies": { diff --git a/packages/plugin-component/CHANGELOG.md b/packages/plugin-component/CHANGELOG.md index da9b8604..40de0433 100644 --- a/packages/plugin-component/CHANGELOG.md +++ b/packages/plugin-component/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + +**Note:** Version bump only for package @merkur/plugin-component + + + + + # [0.24.0](https://github.com/mjancarik/merkur/compare/v0.23.12...v0.24.0) (2021-05-28) diff --git a/packages/plugin-component/package-lock.json b/packages/plugin-component/package-lock.json index 7cfe9c4d..a9699421 100644 --- a/packages/plugin-component/package-lock.json +++ b/packages/plugin-component/package-lock.json @@ -1,6 +1,6 @@ { "name": "@merkur/plugin-component", - "version": "0.24.0", + "version": "0.24.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/plugin-component/package.json b/packages/plugin-component/package.json index 5a5035df..27067313 100644 --- a/packages/plugin-component/package.json +++ b/packages/plugin-component/package.json @@ -1,6 +1,6 @@ { "name": "@merkur/plugin-component", - "version": "0.24.0", + "version": "0.24.1", "description": "Merkur component plugin.", "main": "lib/index", "module": "lib/index", @@ -43,7 +43,7 @@ }, "homepage": "https://merkur.js.org/", "devDependencies": { - "@merkur/core": "^0.24.0", + "@merkur/core": "^0.24.1", "rollup": "^2.51.0" }, "peerDependencies": { diff --git a/packages/plugin-css-scrambler/CHANGELOG.md b/packages/plugin-css-scrambler/CHANGELOG.md index e69de29b..172b8da1 100644 --- a/packages/plugin-css-scrambler/CHANGELOG.md +++ b/packages/plugin-css-scrambler/CHANGELOG.md @@ -0,0 +1,8 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.24.1](https://github.com/mjancarik/merkur/compare/v0.24.0...v0.24.1) (2021-06-06) + +**Note:** Version bump only for package @merkur/plugin-css-scrambler diff --git a/packages/plugin-css-scrambler/README.md b/packages/plugin-css-scrambler/README.md index 8f69bd72..f7d64b4b 100644 --- a/packages/plugin-css-scrambler/README.md +++ b/packages/plugin-css-scrambler/README.md @@ -1,113 +1,47 @@ -# Merkur - plugin-css-scrambler +
+ + + +
-[![Build Status](https://github.com/mjancarik/merkur/workflows/CI/badge.svg)](https://travis-ci.com/mjancarik/merkur) -[![NPM package version](https://img.shields.io/npm/v/@merkur/plugin-css-scrambler/latest.svg)](https://www.npmjs.com/package/@merkur/plugin-css-scrambler) -![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/minzip/@merkur/plugin-css-scrambler/latest) -[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) - -`merkur/plugin-css-scrambler` scrambles css classes for production build. - -``` -npm i --save @merkur/plugin-css-scrambler -npm i --save-dev postcss postcss-loader -``` - -### 1. Generate hashtable at build time - -This can be achieved by extending webpack config with provided drop-in function. This function will find existing `postcss-loader` and extend it's config to use scrambling plugin or will define `postcss-loader` for default CSS rule. - -```diff -+ const { applyPostCssScramblePlugin } = require('@merkur/plugin-css-scrambler/postcss'); - -module.exports = Promise.all([ -- pipe(createWebConfig, applyBabelLoader)(), -+ pipe(createWebConfig, applyBabelLoader, applyPostCssScramblePlugin)(), -- pipe(createWebConfig, applyBabelLoader, applyES5Transformation)(), -+ pipe(createWebConfig, applyBabelLoader, applyES5Transformation, applyPostCssScramblePlugin)(), - pipe(createNodeConfig, applyBabelLoader)(), -]); -``` +# Merkur -If you have custom webpack configuration you can just define `postcss-loader` for your styles rule and then call `applyPostCssScramblePlugin` or you can apply the scramler plugin manually. - - -```javascript -const path = require('path'); -const { postCssScrambler } = require('@merkur/plugin-css-scrambler/postcss'); - -{ - loader: 'postcss-loader', - options: { - postcssOptions: { - plugins: [ - postCssScrambler({ - generateHashTable: true, - hashTable: path.resolve( - process.env.WIDGET_DIRNAME, - './build/static/hashtable.json' - ), - }), - ], - }, - }, -} -``` - -### 2. Load generated hashtable in widget router +[![Build Status](https://github.com/mjancarik/merkur/workflows/CI/badge.svg)](https://github.com/mjancarik/merkur/actions/workflows/ci.yml) +[![NPM package version](https://img.shields.io/npm/v/@merkur/core/latest.svg)](https://www.npmjs.com/package/@merkur/core) +![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/minzip/@merkur/core/latest) +[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) -```javascript -const { loadClassnameHashtable } = require('@merkur/plugin-css-scrambler/server'); -const merkurModule = require('../../../build/widget.cjs'); -const classnameHashtable = loadClassnameHashtable( - path.resolve(__dirname, '../../build/static/hashtable.json') -); +The [Merkur](https://merkur.js.org/) is tiny extensible javascript library for front-end microservices(micro frontends). It allows by default server side rendering for loading performance boost. You can connect it with other frameworks or languages because merkur defines easy API. You can use one of six predefined template's library [React](https://reactjs.org/), [Preact](https://preactjs.com/), [hyperHTML](https://viperhtml.js.org/hyper.html), [µhtml](https://github.com/WebReflection/uhtml#readme), [Svelte](https://svelte.dev/) and [vanilla](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) but you can easily extend for others. -router.get('/widget', asyncMiddleware(async (req, res) => { - const widget = await merkurModule.createWidget({ - classnameHashtable - props: { - // ... - } - }); +## Features + - Flexible templating engine + - Usable with all tech stacks + - SSR-ready by default + - Easy extensible with plugins + - Tiny - 1 KB minified + gzipped - // ... -})); -``` +## Getting started -### 3. Register plugin in your `widget.js`. +```bash +npx @merkur/create-widget