catalyst-core-internal 0.0.1-beta.37 → 0.0.1-beta.39
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
|
@@ -1,18 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## [0.0.1-beta.
|
|
3
|
+
## [0.0.1-beta.7] - 19-10-2024
|
|
4
4
|
|
|
5
5
|
### Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- Removed
|
|
9
|
-
-
|
|
10
|
-
- Added exports inside package.json for tree shakeable support for logger, caching and ClientRouter.js
|
|
11
|
-
- Hidden unnecessary files from published package:
|
|
12
|
-
.prettierrc.json
|
|
13
|
-
.eslintrc
|
|
14
|
-
.eslintignore
|
|
15
|
-
/.husky
|
|
16
|
-
/.github
|
|
17
|
-
commitlint.config.js
|
|
18
|
-
tsconfig.json
|
|
7
|
+
- Added postcss-scss parser to parse scss in dev mode.
|
|
8
|
+
- Removed default meta tags if the user chooses to setup their own document.
|
|
9
|
+
- Fix assets being injected in the documnet sent from the server.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=_default;function _default(){return{visitor:{CallExpression(nodePath,state){if(nodePath.node.callee.name==="require"&&nodePath.node.arguments.length===1){const argument=nodePath.node.arguments[0];if(argument.type==="StringLiteral"){const requiredPath=argument.value;// Normalize the path for comparison
|
|
2
|
+
const normalizedPath=path.join(path.dirname(state.file.opts.filename),requiredPath);const fullPath=`file://${normalizedPath}${path.extname(normalizedPath)?"":".js"}`;if(clientComponentPaths.has(fullPath)){// Replace with placeholder
|
|
3
|
+
argument.value="/* CLIENT_COMPONENT_PLACEHOLDER */";console.log(`Replaced require for client component: ${fullPath}`);}}}}}};}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.default=void 0;const{sources}=require("webpack");const RawSource=sources.RawSource;const PLUGIN_NAME="rsc-client-plugin";class ClientDirectivePlugin{constructor(){this.clientFiles=[];}apply(compiler){compiler.hooks.emit.tapAsync(PLUGIN_NAME,(compilation,callback)=>{compilation.modules.forEach(module=>{const source=module._source?.source();if(source?.includes('"use client"')){this.clientFiles.push(module.resource);const chunkName="rsc-"+module.resource.split("/").pop();compilation.emitAsset(chunkName,new RawSource(source));}});console.log("Client Files:",this.clientFiles);callback();});}}var _default=exports.default=ClientDirectivePlugin;// const acorn = require("acorn")
|
|
2
|
+
// const path = require("path")
|
|
3
|
+
// class UseClientChunkPlugin {
|
|
4
|
+
// constructor() {
|
|
5
|
+
// this.clientFiles = new Map()
|
|
6
|
+
// }
|
|
7
|
+
// apply(compiler) {
|
|
8
|
+
// compiler.hooks.beforeCompile.tap("UseClientChunkPlugin", () => {
|
|
9
|
+
// this.clientFiles.clear()
|
|
10
|
+
// })
|
|
11
|
+
// compiler.hooks.normalModuleFactory.tap("UseClientChunkPlugin", (normalModuleFactory) => {
|
|
12
|
+
// normalModuleFactory.hooks.parser.for("javascript/auto").tap("UseClientChunkPlugin", (parser) => {
|
|
13
|
+
// parser.hooks.program.tap("UseClientChunkPlugin", (ast, { resource }) => {
|
|
14
|
+
// if (this.hasUseClientDirective(ast)) {
|
|
15
|
+
// this.clientFiles.set(resource, null)
|
|
16
|
+
// }
|
|
17
|
+
// })
|
|
18
|
+
// })
|
|
19
|
+
// })
|
|
20
|
+
// compiler.hooks.thisCompilation.tap("UseClientChunkPlugin", (compilation) => {
|
|
21
|
+
// compilation.hooks.optimizeChunks.tap("UseClientChunkPlugin", (chunks) => {
|
|
22
|
+
// const clientChunk = compilation.addChunk("client")
|
|
23
|
+
// chunks.forEach((chunk) => {
|
|
24
|
+
// chunk.modulesIterable.forEach((module) => {
|
|
25
|
+
// if (this.clientFiles.has(module.resource)) {
|
|
26
|
+
// compilation.moveModulesBetweenChunks([module], chunk, clientChunk)
|
|
27
|
+
// this.clientFiles.set(module.resource, clientChunk.id)
|
|
28
|
+
// }
|
|
29
|
+
// })
|
|
30
|
+
// })
|
|
31
|
+
// })
|
|
32
|
+
// compilation.hooks.afterOptimizeChunks.tap("UseClientChunkPlugin", (chunks) => {
|
|
33
|
+
// chunks.forEach((chunk) => {
|
|
34
|
+
// chunk.modulesIterable.forEach((module) => {
|
|
35
|
+
// if (module.dependencies) {
|
|
36
|
+
// module.dependencies.forEach((dependency) => {
|
|
37
|
+
// if (dependency.module && this.clientFiles.has(dependency.module.resource)) {
|
|
38
|
+
// const clientChunkId = this.clientFiles.get(dependency.module.resource)
|
|
39
|
+
// if (clientChunkId !== null) {
|
|
40
|
+
// dependency.weak = true
|
|
41
|
+
// chunk.addChunkId(clientChunkId)
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
|
+
// })
|
|
45
|
+
// }
|
|
46
|
+
// })
|
|
47
|
+
// })
|
|
48
|
+
// })
|
|
49
|
+
// compilation.hooks.afterOptimizeChunks.tap("UseClientChunkPlugin", () => {
|
|
50
|
+
// console.log('Files with "use client" directive:')
|
|
51
|
+
// this.clientFiles.forEach((chunkId, file) => {
|
|
52
|
+
// console.log(`${path.basename(file)}: ${chunkId}`)
|
|
53
|
+
// })
|
|
54
|
+
// })
|
|
55
|
+
// })
|
|
56
|
+
// }
|
|
57
|
+
// hasUseClientDirective(ast) {
|
|
58
|
+
// for (const node of ast.body) {
|
|
59
|
+
// if (node.type === "ExpressionStatement" && node.directive === "use client") {
|
|
60
|
+
// return true
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
63
|
+
// return false
|
|
64
|
+
// }
|
|
65
|
+
// }
|
|
66
|
+
// module.exports = UseClientChunkPlugin
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "catalyst-core-internal",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.39",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Web framework that provides great performance out of the box",
|
|
6
6
|
"bin": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@loadable/webpack-plugin": "^5.15.2",
|
|
49
49
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
|
|
50
50
|
"@svgr/webpack": "^8.1.0",
|
|
51
|
-
"@tata1mg/router": "0.0.1-beta.
|
|
51
|
+
"@tata1mg/router": "0.0.1-beta.4",
|
|
52
52
|
"app-root-path": "^3.1.0",
|
|
53
53
|
"babel-loader": "^9.1.3",
|
|
54
54
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|