dinou 4.0.7 → 4.0.8
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/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
7
7
|
|
|
8
|
+
## [4.0.8]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Increase versions of concurrently and copy-webpack-plugin for vulnerabilities.
|
|
13
|
+
- Uninstall css-modules-require-hook and create dinou/core/css-require-hook.js.
|
|
14
|
+
|
|
8
15
|
## [4.0.7]
|
|
9
16
|
|
|
10
17
|
### Fixed
|
|
@@ -6,10 +6,7 @@ const createScopedName = require("./createScopedName");
|
|
|
6
6
|
const { extensionsWithDot } = require("./asset-extensions.js");
|
|
7
7
|
const { getAbsPathWithExt } = require("./get-abs-path-with-ext.js");
|
|
8
8
|
|
|
9
|
-
require("css-
|
|
10
|
-
generateScopedName: createScopedName,
|
|
11
|
-
extensions: [".css"],
|
|
12
|
-
});
|
|
9
|
+
require("./css-require-hook.js")();
|
|
13
10
|
|
|
14
11
|
exports.resolve = async function resolve(specifier, context, defaultResolve) {
|
|
15
12
|
const absPathWithExt = getAbsPathWithExt(specifier, context);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const postcss = require("postcss");
|
|
3
|
+
const createScopedName = require("./createScopedName");
|
|
4
|
+
|
|
5
|
+
function registerCSSRequireHook() {
|
|
6
|
+
require.extensions[".css"] = function (module, filename) {
|
|
7
|
+
const cssContent = fs.readFileSync(filename, "utf8");
|
|
8
|
+
const jsonResult = {};
|
|
9
|
+
|
|
10
|
+
const plugin = {
|
|
11
|
+
postcssPlugin: "extract-classes",
|
|
12
|
+
Rule(rule) {
|
|
13
|
+
// Ignorar clases dentro de animaciones (@keyframes)
|
|
14
|
+
if (rule.parent && rule.parent.name === "keyframes") {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const selector = rule.selector;
|
|
19
|
+
// Regex para capturar nombres de clases válidos
|
|
20
|
+
const classRegex = /\.([_a-zA-Z0-9-]+)/g;
|
|
21
|
+
let match;
|
|
22
|
+
|
|
23
|
+
while ((match = classRegex.exec(selector)) !== null) {
|
|
24
|
+
const className = match[1];
|
|
25
|
+
|
|
26
|
+
// Manejo de selectores :global y :local
|
|
27
|
+
const index = match.index;
|
|
28
|
+
const before = selector.slice(0, index);
|
|
29
|
+
const lastGlobal = before.lastIndexOf(":global");
|
|
30
|
+
const lastLocal = before.lastIndexOf(":local");
|
|
31
|
+
|
|
32
|
+
// Si la clase está bajo el ámbito de un :global activo, no la hasheamos
|
|
33
|
+
if (lastGlobal > lastLocal) {
|
|
34
|
+
const afterGlobal = before.slice(lastGlobal);
|
|
35
|
+
if (afterGlobal.includes("(")) {
|
|
36
|
+
const openParens = afterGlobal.split("(").length - 1;
|
|
37
|
+
const closeParens = afterGlobal.split(")").length - 1;
|
|
38
|
+
if (openParens > closeParens) {
|
|
39
|
+
jsonResult[className] = className;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
// Ejemplo: :global .my-class (sin paréntesis)
|
|
44
|
+
jsonResult[className] = className;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Si es una clase local, generamos el hash determinista correspondiente
|
|
50
|
+
if (!jsonResult[className]) {
|
|
51
|
+
jsonResult[className] = createScopedName(className, filename);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// Procesamos de forma estrictamente síncrona (PostCSS es síncrono si sus plugins lo son)
|
|
58
|
+
postcss([plugin]).process(cssContent, { from: filename }).css;
|
|
59
|
+
|
|
60
|
+
module.exports = jsonResult;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = registerCSSRequireHook;
|
|
@@ -14,9 +14,7 @@ babelRegister({
|
|
|
14
14
|
const addHook = require("./asset-require-hook.js");
|
|
15
15
|
const { extensions } = require("./asset-extensions.js");
|
|
16
16
|
const createScopedName = require("./createScopedName");
|
|
17
|
-
require("css-
|
|
18
|
-
generateScopedName: createScopedName,
|
|
19
|
-
});
|
|
17
|
+
require("./css-require-hook.js")();
|
|
20
18
|
addHook({
|
|
21
19
|
extensions,
|
|
22
20
|
name: function (localName, filepath) {
|
package/dinou/core/server.js
CHANGED
|
@@ -23,9 +23,7 @@ babelRegister({
|
|
|
23
23
|
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
24
24
|
});
|
|
25
25
|
const createScopedName = require("./createScopedName");
|
|
26
|
-
require("css-
|
|
27
|
-
generateScopedName: createScopedName,
|
|
28
|
-
});
|
|
26
|
+
require("./css-require-hook.js")();
|
|
29
27
|
addHook({
|
|
30
28
|
extensions,
|
|
31
29
|
name: function (localName, filepath) {
|
package/dinou/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dinou-ejected",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"private": true,
|
|
6
6
|
"exports": {
|
|
@@ -37,12 +37,11 @@
|
|
|
37
37
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
38
38
|
"chokidar": "^4.0.3",
|
|
39
39
|
"commander": "^14.0.0",
|
|
40
|
-
"concurrently": "^
|
|
40
|
+
"concurrently": "^10.0.3",
|
|
41
41
|
"cookie-parser": "^1.4.7",
|
|
42
|
-
"copy-webpack-plugin": "^
|
|
42
|
+
"copy-webpack-plugin": "^14.0.0",
|
|
43
43
|
"cross-env": "^7.0.3",
|
|
44
44
|
"css-loader": "^7.1.2",
|
|
45
|
-
"css-modules-require-hook": "^4.2.3",
|
|
46
45
|
"dotenv": "^16.5.0",
|
|
47
46
|
"esbuild": "^0.27.0",
|
|
48
47
|
"esbuild-copy-static-files": "^0.1.0",
|
|
@@ -74,4 +73,4 @@
|
|
|
74
73
|
"react": ">=19.2.3",
|
|
75
74
|
"react-dom": ">=19.2.3"
|
|
76
75
|
}
|
|
77
|
-
}
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dinou",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8",
|
|
4
4
|
"description": "Full-Stack React 19 framework with React Server Components, Server Functions, and Streaming SSR.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -61,12 +61,11 @@
|
|
|
61
61
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
62
62
|
"chokidar": "^4.0.3",
|
|
63
63
|
"commander": "^14.0.0",
|
|
64
|
-
"concurrently": "^
|
|
64
|
+
"concurrently": "^10.0.3",
|
|
65
65
|
"cookie-parser": "^1.4.7",
|
|
66
|
-
"copy-webpack-plugin": "^
|
|
66
|
+
"copy-webpack-plugin": "^14.0.0",
|
|
67
67
|
"cross-env": "^7.0.3",
|
|
68
68
|
"css-loader": "^7.1.2",
|
|
69
|
-
"css-modules-require-hook": "^4.2.3",
|
|
70
69
|
"dotenv": "^16.5.0",
|
|
71
70
|
"esbuild": "^0.27.0",
|
|
72
71
|
"esbuild-copy-static-files": "^0.1.0",
|