@nimpl/classnames-minifier 0.0.0-experimental-7dbcd07 → 0.0.0-experimental-19d046b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -12,10 +12,25 @@ Visit https://nimpl.dev/docs/classnames-minifier to view the full documentation.
|
|
|
12
12
|
npm i @nimpl/classnames-minifier
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { type NextConfig } from "next";
|
|
19
|
+
import classNamesMinifier from "@nimpl/classnames-minifier";
|
|
20
|
+
|
|
21
|
+
const withClassNamesMinifier = classNamesMinifier({
|
|
22
|
+
/* plugin options here */
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const nextConfig: NextConfig = withClassNamesMinifier({
|
|
26
|
+
/* next options here */
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default nextConfig;
|
|
30
|
+
```
|
|
16
31
|
|
|
17
32
|
```bash
|
|
18
|
-
|
|
33
|
+
npm run build --webpack
|
|
19
34
|
```
|
|
20
35
|
|
|
21
36
|
## License
|
|
@@ -8,10 +8,25 @@ const path_1 = __importDefault(require("path"));
|
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const injectConfig_1 = __importDefault(require("./lib/injectConfig"));
|
|
10
10
|
let classnamesMinifier;
|
|
11
|
+
const isTurbopackEnabled = (nextConfig) => {
|
|
12
|
+
var _a;
|
|
13
|
+
if (((_a = nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental) === null || _a === void 0 ? void 0 : _a.turbo) || (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.turbopack)) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
if (process.env.NEXT_PRIVATE_TURBO === "1" || process.env.TURBOPACK != null || process.argv.includes("--turbo")) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
};
|
|
11
21
|
const withClassnameMinifier = (pluginOptions = {}) => {
|
|
12
22
|
return (nextConfig = {}) => {
|
|
13
23
|
if (pluginOptions.disabled)
|
|
14
24
|
return nextConfig;
|
|
25
|
+
const turbopackEnabled = isTurbopackEnabled(nextConfig);
|
|
26
|
+
if (turbopackEnabled) {
|
|
27
|
+
console.warn("classnames-minifier is disabled in turbopack mode. Please run the process with `--webpack` flag");
|
|
28
|
+
return nextConfig;
|
|
29
|
+
}
|
|
15
30
|
if (!classnamesMinifier) {
|
|
16
31
|
const distDir = (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.distDir) || ".next";
|
|
17
32
|
const distDirAbsolute = path_1.default.join(process.cwd(), distDir);
|
|
@@ -3,10 +3,25 @@ import path from "path";
|
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import injectConfig from "./lib/injectConfig";
|
|
5
5
|
let classnamesMinifier;
|
|
6
|
+
const isTurbopackEnabled = (nextConfig) => {
|
|
7
|
+
var _a;
|
|
8
|
+
if (((_a = nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.experimental) === null || _a === void 0 ? void 0 : _a.turbo) || (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.turbopack)) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
if (process.env.NEXT_PRIVATE_TURBO === "1" || process.env.TURBOPACK != null || process.argv.includes("--turbo")) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
};
|
|
6
16
|
const withClassnameMinifier = (pluginOptions = {}) => {
|
|
7
17
|
return (nextConfig = {}) => {
|
|
8
18
|
if (pluginOptions.disabled)
|
|
9
19
|
return nextConfig;
|
|
20
|
+
const turbopackEnabled = isTurbopackEnabled(nextConfig);
|
|
21
|
+
if (turbopackEnabled) {
|
|
22
|
+
console.warn("classnames-minifier is disabled in turbopack mode. Please run the process with `--webpack` flag");
|
|
23
|
+
return nextConfig;
|
|
24
|
+
}
|
|
10
25
|
if (!classnamesMinifier) {
|
|
11
26
|
const distDir = (nextConfig === null || nextConfig === void 0 ? void 0 : nextConfig.distDir) || ".next";
|
|
12
27
|
const distDirAbsolute = path.join(process.cwd(), distDir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimpl/classnames-minifier",
|
|
3
|
-
"version": "0.0.0-experimental-
|
|
3
|
+
"version": "0.0.0-experimental-19d046b",
|
|
4
4
|
"description": "Library for configuring style modules to generate compressed classes",
|
|
5
5
|
"main": "dist/cjs/withClassnamesMinifier.js",
|
|
6
6
|
"module": "dist/esm/withClassnamesMinifier.mjs",
|