From 3d6035d56374dbbfa74536f6c7475f3a5ff97001 Mon Sep 17 00:00:00 2001 From: Freeman <46896789+soranoo@users.noreply.github.com> Date: Fri, 30 May 2025 19:24:47 +0100 Subject: [PATCH 1/2] fix: update key names in loadConversionTables for consistency --- README.md | 21 +++++++-------------- src/utils.ts | 8 ++++---- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 7fe27e1..a747b48 100644 --- a/README.md +++ b/README.md @@ -170,6 +170,7 @@ Visit the [npm](https://www.npmjs.com/package/next-css-obfuscator) page. ##### Obfuscate all files ```javascript + /** @type {import("next-css-obfuscator").Options} */ module.exports = { enable: true, mode: "random", // random | simplify @@ -181,10 +182,11 @@ Visit the [npm](https://www.npmjs.com/package/next-css-obfuscator) page. ##### Partially obfuscate - > [!CAUTION]\ - > Partially obfuscate can be EXTREMELY buggy. Be cautious when using this feature. +> [!CAUTION]\ +> Partially obfuscate can be EXTREMELY buggy. Be cautious when using this feature. ```javascript + /** @type {import("next-css-obfuscator").Options} */ module.exports = { enable: true, mode: "random", // random | simplify @@ -196,20 +198,10 @@ Visit the [npm](https://www.npmjs.com/package/next-css-obfuscator) page. ``` - ##### TypeScript - - ```ts - import { Options } from "next-css-obfuscator"; - - module.exports = { - // other options ... - } satisfies Options; - ``` - Feel free to checkout [📖 Config Options Reference](#-config-options-reference) for more options and details. - > [!TIP]\ - > The obfuscation will never work as expected, tweak the options with your own needs. +> [!TIP]\ +> The obfuscation will never work as expected, tweak the options with your own needs. 2. Add the following code to `package.json`: @@ -286,6 +278,7 @@ If you are interested in my setting, here it is ```javascript // next-css-obfuscator.config.cjs +/** @type {import("next-css-obfuscator").Options} */ module.exports = { enable: true, mode: "random", // random | simplify diff --git a/src/utils.ts b/src/utils.ts index 229bd13..84e6bfd 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -607,11 +607,11 @@ export const loadConversionTables = (folderPath: string): ConversionTables => { const fileData = JSON.parse(fs.readFileSync(filePath, "utf-8")); if ( - Object.keys(fileData).includes("ident") && - Object.keys(fileData).includes("selector") + Object.keys(fileData).includes("idents") && + Object.keys(fileData).includes("selectors") ) { - Object.assign(tables.idents, fileData.ident); - Object.assign(tables.selectors, fileData.selector); + Object.assign(tables.idents, fileData.idents); + Object.assign(tables.selectors, fileData.selectors); } else { // if the file doesn't have ident, it should be selector //? For backward compatibility From 88c2a54f9f1f964d09c0223ff3f3ed30f35ab439 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 30 May 2025 18:25:31 +0000 Subject: [PATCH 2/2] chore(release): 3.0.0-beta.5 [skip ci] # [3.0.0-beta.5](https://github.com/soranoo/next-css-obfuscator/compare/v3.0.0-beta.4...v3.0.0-beta.5) (2025-05-30) ### Bug Fixes * update key names in loadConversionTables for consistency ([3d6035d](https://github.com/soranoo/next-css-obfuscator/commit/3d6035d56374dbbfa74536f6c7475f3a5ff97001)) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca340e3..05aae5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "next-css-obfuscator", - "version": "3.0.0-beta.4", + "version": "3.0.0-beta.5", "description": "A package deeply inspired by PostCSS-Obfuscator but for Next.js.", "main": "dist/index.js", "type": "commonjs",