arcanajs 2.0.2 → 2.1.0
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/bin/arcanajs.js +3 -0
- package/framework/cli/index.d.ts +1 -0
- package/framework/cli/index.js +107 -0
- package/framework/cli/webpack.config.d.ts +3 -0
- package/framework/cli/webpack.config.js +198 -0
- package/{lib → framework/lib}/server/ArcanaJSServer.js +3 -6
- package/package.json +32 -38
- package/babel.config.js +0 -7
- package/postcss.config.js +0 -6
- package/tailwind.config.js +0 -8
- package/tsconfig.json +0 -16
- package/webpack.client.js +0 -71
- package/webpack.server.js +0 -39
- /package/{lib → framework/lib}/client/index.d.ts +0 -0
- /package/{lib → framework/lib}/client/index.js +0 -0
- /package/{lib → framework/lib}/index.d.ts +0 -0
- /package/{lib → framework/lib}/index.js +0 -0
- /package/{lib → framework/lib}/server/ArcanaJSMiddleware.d.ts +0 -0
- /package/{lib → framework/lib}/server/ArcanaJSMiddleware.js +0 -0
- /package/{lib → framework/lib}/server/ArcanaJSServer.d.ts +0 -0
- /package/{lib → framework/lib}/server/ControllerBinder.d.ts +0 -0
- /package/{lib → framework/lib}/server/ControllerBinder.js +0 -0
- /package/{lib → framework/lib}/server/CsrfMiddleware.d.ts +0 -0
- /package/{lib → framework/lib}/server/CsrfMiddleware.js +0 -0
- /package/{lib → framework/lib}/server/DynamicRouter.d.ts +0 -0
- /package/{lib → framework/lib}/server/DynamicRouter.js +0 -0
- /package/{lib → framework/lib}/server/ResponseHandlerMiddleware.d.ts +0 -0
- /package/{lib → framework/lib}/server/ResponseHandlerMiddleware.js +0 -0
- /package/{lib → framework/lib}/server/Router.d.ts +0 -0
- /package/{lib → framework/lib}/server/Router.js +0 -0
- /package/{lib → framework/lib}/server.d.ts +0 -0
- /package/{lib → framework/lib}/server.js +0 -0
- /package/{lib → framework/lib}/shared/ArcanaJSApp.d.ts +0 -0
- /package/{lib → framework/lib}/shared/ArcanaJSApp.js +0 -0
- /package/{lib → framework/lib}/shared/components/Body.d.ts +0 -0
- /package/{lib → framework/lib}/shared/components/Body.js +0 -0
- /package/{lib → framework/lib}/shared/components/Head.d.ts +0 -0
- /package/{lib → framework/lib}/shared/components/Head.js +0 -0
- /package/{lib → framework/lib}/shared/components/Link.d.ts +0 -0
- /package/{lib → framework/lib}/shared/components/Link.js +0 -0
- /package/{lib → framework/lib}/shared/components/NavLink.d.ts +0 -0
- /package/{lib → framework/lib}/shared/components/NavLink.js +0 -0
- /package/{lib → framework/lib}/shared/components/Page.d.ts +0 -0
- /package/{lib → framework/lib}/shared/components/Page.js +0 -0
- /package/{lib → framework/lib}/shared/context/HeadContext.d.ts +0 -0
- /package/{lib → framework/lib}/shared/context/HeadContext.js +0 -0
- /package/{lib → framework/lib}/shared/context/PageContext.d.ts +0 -0
- /package/{lib → framework/lib}/shared/context/PageContext.js +0 -0
- /package/{lib → framework/lib}/shared/context/RouterContext.d.ts +0 -0
- /package/{lib → framework/lib}/shared/context/RouterContext.js +0 -0
- /package/{lib → framework/lib}/shared/core/ArcanaJSApp.d.ts +0 -0
- /package/{lib → framework/lib}/shared/core/ArcanaJSApp.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/useDynamicComponents.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/useDynamicComponents.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/useHead.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/useHead.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/useLocation.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/useLocation.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/usePage.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/usePage.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/useParams.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/useParams.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/useQuery.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/useQuery.js +0 -0
- /package/{lib → framework/lib}/shared/hooks/useRouter.d.ts +0 -0
- /package/{lib → framework/lib}/shared/hooks/useRouter.js +0 -0
- /package/{lib → framework/lib}/shared/utils/createSingletonContext.d.ts +0 -0
- /package/{lib → framework/lib}/shared/utils/createSingletonContext.js +0 -0
package/bin/arcanajs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
9
|
+
const webpack_config_1 = require("./webpack.config");
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
const command = args[0];
|
|
12
|
+
if (!command) {
|
|
13
|
+
console.error("Please specify a command: dev, build, start");
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
const runCompiler = (compiler) => {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
compiler.run((err, stats) => {
|
|
19
|
+
if (err) {
|
|
20
|
+
console.error(err);
|
|
21
|
+
return reject(err);
|
|
22
|
+
}
|
|
23
|
+
if (stats && stats.hasErrors()) {
|
|
24
|
+
console.error(stats.toString({ colors: true }));
|
|
25
|
+
return reject(new Error("Webpack build failed"));
|
|
26
|
+
}
|
|
27
|
+
console.log(stats?.toString({ colors: true }));
|
|
28
|
+
resolve();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
let serverProcess = null;
|
|
33
|
+
const startDevServer = () => {
|
|
34
|
+
if (serverProcess) {
|
|
35
|
+
serverProcess.kill();
|
|
36
|
+
}
|
|
37
|
+
const serverPath = path_1.default.resolve(process.cwd(), "dist/server.js");
|
|
38
|
+
serverProcess = (0, child_process_1.spawn)("node", [serverPath], { stdio: "inherit" });
|
|
39
|
+
serverProcess.on("close", (code) => {
|
|
40
|
+
if (code !== 0 && code !== null) {
|
|
41
|
+
console.error(`Dev server exited with code ${code}`);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const watchCompiler = (compiler, onBuildComplete) => {
|
|
46
|
+
compiler.watch({}, (err, stats) => {
|
|
47
|
+
if (err) {
|
|
48
|
+
console.error(err);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
console.log(stats?.toString({ colors: true }));
|
|
52
|
+
if (stats && !stats.hasErrors() && onBuildComplete) {
|
|
53
|
+
onBuildComplete();
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const build = async () => {
|
|
58
|
+
process.env.NODE_ENV = "production";
|
|
59
|
+
console.log("Building for production...");
|
|
60
|
+
const clientConfig = (0, webpack_config_1.createClientConfig)();
|
|
61
|
+
const serverConfig = (0, webpack_config_1.createServerConfig)();
|
|
62
|
+
try {
|
|
63
|
+
await runCompiler((0, webpack_1.default)(clientConfig));
|
|
64
|
+
await runCompiler((0, webpack_1.default)(serverConfig));
|
|
65
|
+
console.log("Build complete.");
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error("Build failed:", error);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const dev = async () => {
|
|
73
|
+
process.env.NODE_ENV = "development";
|
|
74
|
+
console.log("Starting development server...");
|
|
75
|
+
const clientConfig = (0, webpack_config_1.createClientConfig)();
|
|
76
|
+
const serverConfig = (0, webpack_config_1.createServerConfig)();
|
|
77
|
+
// Watch client
|
|
78
|
+
watchCompiler((0, webpack_1.default)(clientConfig));
|
|
79
|
+
// Watch server and restart on build
|
|
80
|
+
watchCompiler((0, webpack_1.default)(serverConfig), () => {
|
|
81
|
+
console.log("Server build complete. Restarting server...");
|
|
82
|
+
startDevServer();
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
const start = () => {
|
|
86
|
+
process.env.NODE_ENV = "production";
|
|
87
|
+
const serverPath = path_1.default.resolve(process.cwd(), "dist/server.js");
|
|
88
|
+
console.log(`Starting server at ${serverPath}...`);
|
|
89
|
+
const child = (0, child_process_1.spawn)("node", [serverPath], { stdio: "inherit" });
|
|
90
|
+
child.on("close", (code) => {
|
|
91
|
+
process.exit(code || 0);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
switch (command) {
|
|
95
|
+
case "build":
|
|
96
|
+
build();
|
|
97
|
+
break;
|
|
98
|
+
case "dev":
|
|
99
|
+
dev();
|
|
100
|
+
break;
|
|
101
|
+
case "start":
|
|
102
|
+
start();
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
console.error(`Unknown command: ${command}`);
|
|
106
|
+
process.exit(1);
|
|
107
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createServerConfig = exports.createClientConfig = void 0;
|
|
7
|
+
const clean_webpack_plugin_1 = require("clean-webpack-plugin");
|
|
8
|
+
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
9
|
+
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const webpack_node_externals_1 = __importDefault(require("webpack-node-externals"));
|
|
12
|
+
const isProduction = process.env.NODE_ENV === "production";
|
|
13
|
+
const cwd = process.cwd();
|
|
14
|
+
// Helper to resolve loaders from the framework's node_modules
|
|
15
|
+
const resolveLoader = (loader) => require.resolve(loader);
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
// Helper to find entry file with supported extensions
|
|
18
|
+
const findEntry = (searchPaths) => {
|
|
19
|
+
const extensions = [".ts", ".tsx", ".js", ".jsx"];
|
|
20
|
+
for (const basePath of searchPaths) {
|
|
21
|
+
for (const ext of extensions) {
|
|
22
|
+
const fullPath = path_1.default.resolve(cwd, basePath + ext);
|
|
23
|
+
if (fs_1.default.existsSync(fullPath)) {
|
|
24
|
+
return fullPath;
|
|
25
|
+
}
|
|
26
|
+
// Also check for index files in directories
|
|
27
|
+
const indexPath = path_1.default.resolve(cwd, basePath, "index" + ext);
|
|
28
|
+
if (fs_1.default.existsSync(indexPath)) {
|
|
29
|
+
return indexPath;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Fallback to example if not found (for internal framework dev) or throw error
|
|
34
|
+
// For now, we'll try the example paths as a last resort before failing
|
|
35
|
+
const exampleClient = path_1.default.resolve(cwd, "src/example/client/index.tsx");
|
|
36
|
+
const exampleServer = path_1.default.resolve(cwd, "src/example/server/index.ts");
|
|
37
|
+
if (searchPaths.some((p) => p.includes("client")) &&
|
|
38
|
+
fs_1.default.existsSync(exampleClient))
|
|
39
|
+
return exampleClient;
|
|
40
|
+
if (searchPaths.some((p) => p.includes("server")) &&
|
|
41
|
+
fs_1.default.existsSync(exampleServer))
|
|
42
|
+
return exampleServer;
|
|
43
|
+
throw new Error(`Could not find entry point. Searched in: ${searchPaths.join(", ")}`);
|
|
44
|
+
};
|
|
45
|
+
const createClientConfig = () => {
|
|
46
|
+
const clientEntry = findEntry([
|
|
47
|
+
"src/client",
|
|
48
|
+
"src/client/index",
|
|
49
|
+
"src/index",
|
|
50
|
+
"src/main",
|
|
51
|
+
]);
|
|
52
|
+
return {
|
|
53
|
+
mode: isProduction ? "production" : "development",
|
|
54
|
+
target: "web",
|
|
55
|
+
entry: {
|
|
56
|
+
client: clientEntry,
|
|
57
|
+
},
|
|
58
|
+
output: {
|
|
59
|
+
path: path_1.default.resolve(cwd, "dist/public"),
|
|
60
|
+
filename: isProduction
|
|
61
|
+
? "[name].[contenthash].bundle.js"
|
|
62
|
+
: "[name].bundle.js",
|
|
63
|
+
publicPath: "/",
|
|
64
|
+
assetModuleFilename: "assets/[hash][ext][query]",
|
|
65
|
+
},
|
|
66
|
+
resolve: {
|
|
67
|
+
extensions: [".ts", ".tsx", ".js", ".jsx"],
|
|
68
|
+
},
|
|
69
|
+
resolveLoader: {
|
|
70
|
+
modules: ["node_modules", path_1.default.resolve(__dirname, "../../node_modules")],
|
|
71
|
+
},
|
|
72
|
+
module: {
|
|
73
|
+
rules: [
|
|
74
|
+
{
|
|
75
|
+
test: /\.(ts|tsx|js|jsx)$/,
|
|
76
|
+
exclude: /node_modules/,
|
|
77
|
+
use: {
|
|
78
|
+
loader: resolveLoader("babel-loader"),
|
|
79
|
+
options: {
|
|
80
|
+
presets: [
|
|
81
|
+
resolveLoader("@babel/preset-env"),
|
|
82
|
+
resolveLoader("@babel/preset-react"),
|
|
83
|
+
resolveLoader("@babel/preset-typescript"),
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
test: /\.css$/,
|
|
90
|
+
use: [
|
|
91
|
+
isProduction
|
|
92
|
+
? mini_css_extract_plugin_1.default.loader
|
|
93
|
+
: resolveLoader("style-loader"),
|
|
94
|
+
resolveLoader("css-loader"),
|
|
95
|
+
resolveLoader("postcss-loader"),
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf|otf)$/i,
|
|
100
|
+
type: "asset/resource",
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
plugins: [
|
|
105
|
+
new clean_webpack_plugin_1.CleanWebpackPlugin(),
|
|
106
|
+
new html_webpack_plugin_1.default({
|
|
107
|
+
template: path_1.default.resolve(cwd, "src/lib/server/default-index.html"),
|
|
108
|
+
filename: "index.html",
|
|
109
|
+
inject: "body",
|
|
110
|
+
minify: isProduction
|
|
111
|
+
? {
|
|
112
|
+
removeComments: false,
|
|
113
|
+
collapseWhitespace: true,
|
|
114
|
+
removeRedundantAttributes: true,
|
|
115
|
+
useShortDoctype: true,
|
|
116
|
+
removeEmptyAttributes: true,
|
|
117
|
+
removeStyleLinkTypeAttributes: true,
|
|
118
|
+
keepClosingSlash: true,
|
|
119
|
+
minifyJS: true,
|
|
120
|
+
minifyCSS: true,
|
|
121
|
+
minifyURLs: true,
|
|
122
|
+
}
|
|
123
|
+
: false,
|
|
124
|
+
}),
|
|
125
|
+
new mini_css_extract_plugin_1.default({
|
|
126
|
+
filename: isProduction ? "[name].[contenthash].css" : "[name].css",
|
|
127
|
+
}),
|
|
128
|
+
],
|
|
129
|
+
optimization: {
|
|
130
|
+
splitChunks: {
|
|
131
|
+
chunks: "all",
|
|
132
|
+
cacheGroups: {
|
|
133
|
+
vendor: {
|
|
134
|
+
test: /[\\/]node_modules[\\/]/,
|
|
135
|
+
name: "vendors",
|
|
136
|
+
chunks: "all",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
exports.createClientConfig = createClientConfig;
|
|
145
|
+
const createServerConfig = () => {
|
|
146
|
+
const serverEntry = findEntry([
|
|
147
|
+
"src/server",
|
|
148
|
+
"src/server/index",
|
|
149
|
+
"src/server/main",
|
|
150
|
+
]);
|
|
151
|
+
return {
|
|
152
|
+
mode: isProduction ? "production" : "development",
|
|
153
|
+
target: "node",
|
|
154
|
+
entry: serverEntry,
|
|
155
|
+
output: {
|
|
156
|
+
path: path_1.default.resolve(cwd, "dist"),
|
|
157
|
+
filename: "server.js",
|
|
158
|
+
},
|
|
159
|
+
externals: [(0, webpack_node_externals_1.default)()],
|
|
160
|
+
resolve: {
|
|
161
|
+
extensions: [".ts", ".tsx", ".js", ".jsx"],
|
|
162
|
+
},
|
|
163
|
+
resolveLoader: {
|
|
164
|
+
modules: ["node_modules", path_1.default.resolve(__dirname, "../../node_modules")],
|
|
165
|
+
},
|
|
166
|
+
module: {
|
|
167
|
+
rules: [
|
|
168
|
+
{
|
|
169
|
+
test: /\.(ts|tsx|js|jsx)$/,
|
|
170
|
+
exclude: /node_modules/,
|
|
171
|
+
use: {
|
|
172
|
+
loader: resolveLoader("babel-loader"),
|
|
173
|
+
options: {
|
|
174
|
+
presets: [
|
|
175
|
+
resolveLoader("@babel/preset-env"),
|
|
176
|
+
resolveLoader("@babel/preset-react"),
|
|
177
|
+
resolveLoader("@babel/preset-typescript"),
|
|
178
|
+
],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
test: /\.css$/,
|
|
184
|
+
use: resolveLoader("null-loader"), // Ignore CSS on server side
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf|otf)$/i,
|
|
188
|
+
type: "asset/resource",
|
|
189
|
+
generator: {
|
|
190
|
+
emit: false,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
exports.createServerConfig = createServerConfig;
|
|
@@ -99,12 +99,9 @@ class ArcanaJSServer {
|
|
|
99
99
|
if (stat.isDirectory()) {
|
|
100
100
|
traverse(fullPath);
|
|
101
101
|
}
|
|
102
|
-
else if (file.endsWith(".tsx") ||
|
|
103
|
-
file.endsWith(".jsx") ||
|
|
104
|
-
file.endsWith(".js") ||
|
|
105
|
-
file.endsWith(".ts")) {
|
|
102
|
+
else if (file.endsWith(".tsx") || file.endsWith(".jsx")) {
|
|
106
103
|
const relativePath = path_1.default.relative(viewsDir, fullPath);
|
|
107
|
-
const viewName = relativePath.replace(/\.(tsx|jsx
|
|
104
|
+
const viewName = relativePath.replace(/\.(tsx|jsx)$/, "");
|
|
108
105
|
try {
|
|
109
106
|
// Use __non_webpack_require__ if available to avoid Webpack bundling issues
|
|
110
107
|
// or standard require if running in Node directly
|
|
@@ -118,7 +115,7 @@ class ArcanaJSServer {
|
|
|
118
115
|
requireFunc("ts-node/register");
|
|
119
116
|
}
|
|
120
117
|
catch (e) {
|
|
121
|
-
|
|
118
|
+
// Ignore if already registered or not found (might be pre-compiled)
|
|
122
119
|
}
|
|
123
120
|
}
|
|
124
121
|
const pageModule = requireFunc(fullPath);
|
package/package.json
CHANGED
|
@@ -1,33 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arcanajs",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "ArcanaJS Framework",
|
|
5
|
-
"main": "lib/index.js",
|
|
6
|
-
"types": "lib/index.d.ts",
|
|
5
|
+
"main": "framework/lib/index.js",
|
|
6
|
+
"types": "framework/lib/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
".": "./lib/index.js",
|
|
9
|
-
"./server": "./lib/server.js"
|
|
8
|
+
".": "./framework/lib/index.js",
|
|
9
|
+
"./server": "./framework/lib/server.js"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"arcanajs": "./bin/arcanajs.js"
|
|
10
13
|
},
|
|
11
14
|
"files": [
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"webpack.server.js",
|
|
15
|
-
"tsconfig.json",
|
|
16
|
-
"babel.config.js",
|
|
17
|
-
"postcss.config.js",
|
|
18
|
-
"tailwind.config.js"
|
|
15
|
+
"framework",
|
|
16
|
+
"bin"
|
|
19
17
|
],
|
|
20
18
|
"scripts": {
|
|
21
|
-
"build": "tsc -p tsconfig.lib.json",
|
|
22
|
-
"build
|
|
23
|
-
"dev
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"dev": "concurrently \"npm run dev:server\" \"npm run dev:client\"",
|
|
27
|
-
"dev:tsx": "concurrently \"npm run dev:server:tsx\" \"npm run dev:client\"",
|
|
28
|
-
"start": "cross-env NODE_ENV=production node dist/server.js"
|
|
19
|
+
"build:lib": "tsc -p tsconfig.lib.json",
|
|
20
|
+
"build": "node bin/arcanajs.js build",
|
|
21
|
+
"dev": "node bin/arcanajs.js dev",
|
|
22
|
+
"start": "node bin/arcanajs.js start",
|
|
23
|
+
"lint": "eslint"
|
|
29
24
|
},
|
|
30
25
|
"dependencies": {
|
|
26
|
+
"compression": "^1.8.1",
|
|
27
|
+
"cookie-parser": "^1.4.7",
|
|
28
|
+
"cross-env": "^10.1.0",
|
|
29
|
+
"express": "^5.1.0",
|
|
30
|
+
"helmet": "^8.1.0",
|
|
31
|
+
"react": "^19.2.0",
|
|
32
|
+
"react-dom": "^19.2.0",
|
|
31
33
|
"@babel/core": "^7.23.0",
|
|
32
34
|
"@babel/preset-env": "^7.23.0",
|
|
33
35
|
"@babel/preset-react": "^7.22.15",
|
|
@@ -36,36 +38,28 @@
|
|
|
36
38
|
"autoprefixer": "^10.4.22",
|
|
37
39
|
"babel-loader": "^10.0.0",
|
|
38
40
|
"clean-webpack-plugin": "^4.0.0",
|
|
39
|
-
"compression": "^1.8.1",
|
|
40
41
|
"concurrently": "^9.2.1",
|
|
41
|
-
"cookie-parser": "^1.4.7",
|
|
42
|
-
"cross-env": "^10.1.0",
|
|
43
42
|
"css-loader": "^7.1.2",
|
|
44
|
-
"express": "^5.1.0",
|
|
45
|
-
"helmet": "^8.1.0",
|
|
46
43
|
"html-webpack-plugin": "^5.6.5",
|
|
47
44
|
"mini-css-extract-plugin": "^2.9.4",
|
|
48
45
|
"null-loader": "^4.0.1",
|
|
49
46
|
"postcss": "^8.5.6",
|
|
50
47
|
"postcss-loader": "^8.2.0",
|
|
51
|
-
"react": "^19.2.0",
|
|
52
|
-
"react-dom": "^19.2.0",
|
|
53
48
|
"style-loader": "^4.0.0",
|
|
54
49
|
"tailwindcss": "^4.1.17",
|
|
55
50
|
"ts-loader": "^9.4.4",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
52
|
+
"tsx": "^4.20.6",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"webpack": "^5.103.0",
|
|
58
55
|
"webpack-cli": "^6.0.1",
|
|
59
|
-
"webpack-node-externals": "^3.0.0"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@types/compression": "^1.8.1",
|
|
63
|
-
"@types/cookie-parser": "^1.4.10",
|
|
56
|
+
"webpack-node-externals": "^3.0.0",
|
|
64
57
|
"@types/express": "^5.0.5",
|
|
65
58
|
"@types/node": "^24.10.1",
|
|
59
|
+
"@types/compression": "^1.8.1",
|
|
60
|
+
"@types/cookie-parser": "^1.4.10",
|
|
66
61
|
"@types/react": "^19.2.7",
|
|
67
|
-
"@types/react-dom": "^19.2.3"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
62
|
+
"@types/react-dom": "^19.2.3"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {}
|
|
71
65
|
}
|
package/babel.config.js
DELETED
package/postcss.config.js
DELETED
package/tailwind.config.js
DELETED
package/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "CommonJS",
|
|
5
|
-
"lib": ["DOM", "ES2020"],
|
|
6
|
-
"jsx": "react",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"rootDir": "./src",
|
|
13
|
-
"moduleResolution": "node"
|
|
14
|
-
},
|
|
15
|
-
"include": ["src/**/*"]
|
|
16
|
-
}
|
package/webpack.client.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
|
3
|
-
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
|
4
|
-
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
5
|
-
|
|
6
|
-
const isProduction = process.env.NODE_ENV === "production";
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
mode: isProduction ? "production" : "development",
|
|
10
|
-
target: "web",
|
|
11
|
-
entry: {
|
|
12
|
-
client: "./src/example/client/index.tsx",
|
|
13
|
-
},
|
|
14
|
-
output: {
|
|
15
|
-
path: path.resolve(__dirname, "dist/public"),
|
|
16
|
-
filename: isProduction
|
|
17
|
-
? "[name].[contenthash].bundle.js"
|
|
18
|
-
: "[name].bundle.js",
|
|
19
|
-
publicPath: "/",
|
|
20
|
-
assetModuleFilename: "assets/[hash][ext][query]",
|
|
21
|
-
},
|
|
22
|
-
resolve: {
|
|
23
|
-
extensions: [".ts", ".tsx", ".js", ".jsx"],
|
|
24
|
-
},
|
|
25
|
-
module: {
|
|
26
|
-
rules: [
|
|
27
|
-
{
|
|
28
|
-
test: /\.(ts|tsx|js|jsx)$/,
|
|
29
|
-
exclude: /node_modules/,
|
|
30
|
-
use: "babel-loader",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
test: /\.css$/,
|
|
34
|
-
use: [
|
|
35
|
-
isProduction ? MiniCssExtractPlugin.loader : "style-loader",
|
|
36
|
-
"css-loader",
|
|
37
|
-
"postcss-loader",
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf|otf)$/i,
|
|
42
|
-
type: "asset/resource",
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
plugins: [
|
|
47
|
-
new CleanWebpackPlugin(),
|
|
48
|
-
new HtmlWebpackPlugin({
|
|
49
|
-
template: "./src/lib/server/default-index.html",
|
|
50
|
-
filename: "index.html",
|
|
51
|
-
inject: "body",
|
|
52
|
-
minify: isProduction,
|
|
53
|
-
}),
|
|
54
|
-
new MiniCssExtractPlugin({
|
|
55
|
-
filename: isProduction ? "[name].[contenthash].css" : "[name].css",
|
|
56
|
-
}),
|
|
57
|
-
],
|
|
58
|
-
optimization: {
|
|
59
|
-
splitChunks: {
|
|
60
|
-
chunks: "all",
|
|
61
|
-
cacheGroups: {
|
|
62
|
-
vendor: {
|
|
63
|
-
test: /[\\/]node_modules[\\/]/,
|
|
64
|
-
name: "vendors",
|
|
65
|
-
chunks: "all",
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
71
|
-
};
|
package/webpack.server.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const nodeExternals = require("webpack-node-externals");
|
|
3
|
-
|
|
4
|
-
const isProduction = process.env.NODE_ENV === "production";
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
mode: isProduction ? "production" : "development",
|
|
8
|
-
target: "node",
|
|
9
|
-
entry: "./src/example/server/index.ts",
|
|
10
|
-
output: {
|
|
11
|
-
path: path.resolve(__dirname, "dist"),
|
|
12
|
-
filename: "server.js",
|
|
13
|
-
},
|
|
14
|
-
externals: [nodeExternals()],
|
|
15
|
-
resolve: {
|
|
16
|
-
extensions: [".ts", ".tsx", ".js", ".jsx"],
|
|
17
|
-
},
|
|
18
|
-
module: {
|
|
19
|
-
rules: [
|
|
20
|
-
{
|
|
21
|
-
test: /\.(ts|tsx|js|jsx)$/,
|
|
22
|
-
exclude: /node_modules/,
|
|
23
|
-
use: "babel-loader",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
test: /\.css$/,
|
|
27
|
-
use: "null-loader", // Ignore CSS on server side
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|eot|ttf|otf)$/i,
|
|
31
|
-
type: "asset/resource",
|
|
32
|
-
generator: {
|
|
33
|
-
emit: false, // Don't emit files for server build, just get paths
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
},
|
|
38
|
-
devtool: isProduction ? "source-map" : "eval-source-map",
|
|
39
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|