rasengan 1.0.0-beta.46 → 1.0.0-beta.47
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 +1 -1
- package/lib/esm/cli/index.js +2 -2
- package/lib/esm/config/index.js +2 -197
- package/lib/esm/config/utils/define-config.js +179 -0
- package/lib/esm/config/utils/index.js +3 -0
- package/lib/esm/config/utils/load-modules.js +114 -0
- package/lib/esm/config/utils/path.js +32 -0
- package/lib/esm/core/components/index.js +5 -5
- package/lib/esm/entries/entry-client.js +2 -7
- package/lib/esm/entries/entry-server-stream.js +3 -3
- package/lib/esm/entries/entry-server.js +2 -9
- package/lib/esm/routing/components/index.js +9 -8
- package/lib/esm/routing/index.js +1 -4
- package/lib/esm/routing/utils/define-router.js +40 -0
- package/lib/esm/routing/utils/generate-metadata.js +86 -0
- package/lib/esm/routing/utils/generate-routes.js +278 -0
- package/lib/esm/routing/utils/index.js +3 -422
- package/lib/esm/server/functions/netlify/netlify/functions/api.js +2 -2
- package/lib/esm/server/functions/vercel/api/index.js +2 -2
- package/lib/esm/server/utils/handleRequest.js +2 -2
- package/lib/esm/server/utils/log.js +2 -2
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/tsconfig.types.tsbuildinfo +1 -0
- package/lib/types/config/index.d.ts +2 -75
- package/lib/types/config/type.d.ts +5 -0
- package/lib/types/config/utils/define-config.d.ts +7 -0
- package/lib/types/config/utils/index.d.ts +3 -0
- package/lib/types/config/utils/load-modules.d.ts +22 -0
- package/lib/types/config/utils/path.d.ts +12 -0
- package/lib/types/core/index.d.ts +1 -1
- package/lib/types/core/types.d.ts +16 -0
- package/lib/types/decorators/types.d.ts +2 -3
- package/lib/types/routing/components/index.d.ts +4 -3
- package/lib/types/routing/index.d.ts +1 -1
- package/lib/types/routing/interfaces.d.ts +0 -1
- package/lib/types/routing/types.d.ts +0 -1
- package/lib/types/routing/utils/define-router.d.ts +8 -0
- package/lib/types/routing/utils/generate-metadata.d.ts +6 -0
- package/lib/types/routing/utils/generate-routes.d.ts +12 -0
- package/lib/types/routing/utils/index.d.ts +3 -39
- package/lib/types/server/functions/netlify/netlify/functions/api.d.ts +1 -0
- package/lib/types/server/utils/createReadableStream.d.ts +0 -1
- package/package.json +2 -2
- package/server.js +2 -35
- package/tsconfig.json +1 -3
- package/types/client.d.ts +7 -0
- package/vite.config.ts +4 -1
- package/CODE_OF_CONDUCT.md +0 -38
- package/CONTRIBUTING.md +0 -0
- package/assets/Rasengan-with-text-black.svg +0 -77
- package/assets/Rasengan-with-text.svg +0 -77
- package/assets/Rasengan-without-text-black.svg +0 -75
- package/assets/Rasengan-without-text.svg +0 -72
- package/assets/cards/1.png +0 -0
- package/lib/esm/server/functions/vercel/vercel.json +0 -16
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://rasengan.dev)
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/rasengan)
|
|
4
4
|
[](https://www.npmjs.com/package/rasengan)
|
package/lib/esm/cli/index.js
CHANGED
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
package/lib/esm/config/index.js
CHANGED
|
@@ -1,197 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (ar || !(i in from)) {
|
|
4
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
5
|
-
ar[i] = from[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
|
-
};
|
|
10
|
-
// import { fileURLToPath } from "node:url";
|
|
11
|
-
/**
|
|
12
|
-
* Function to define the config for the app
|
|
13
|
-
* It will be used by vite.config.ts and other files in other to configure the app
|
|
14
|
-
* @param {AppConfig} loadedConfig
|
|
15
|
-
*/
|
|
16
|
-
export var defineConfig = function (loadedConfig) {
|
|
17
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
18
|
-
var reactStrictMode = loadedConfig.reactStrictMode, server = loadedConfig.server, vite = loadedConfig.vite, experimental = loadedConfig.experimental;
|
|
19
|
-
// Define default values for vite config coming from loadedConfig.vite
|
|
20
|
-
var defaultViteConfig = {
|
|
21
|
-
plugins: (vite === null || vite === void 0 ? void 0 : vite.plugins) || [],
|
|
22
|
-
optimizeDeps: {
|
|
23
|
-
exclude: ((_a = vite === null || vite === void 0 ? void 0 : vite.optimizeDeps) === null || _a === void 0 ? void 0 : _a.exclude) || [],
|
|
24
|
-
include: ((_b = vite === null || vite === void 0 ? void 0 : vite.optimizeDeps) === null || _b === void 0 ? void 0 : _b.include) || [],
|
|
25
|
-
},
|
|
26
|
-
css: {
|
|
27
|
-
postcss: ((_c = vite === null || vite === void 0 ? void 0 : vite.css) === null || _c === void 0 ? void 0 : _c.postcss) || undefined,
|
|
28
|
-
},
|
|
29
|
-
build: {
|
|
30
|
-
external: ((_d = vite === null || vite === void 0 ? void 0 : vite.build) === null || _d === void 0 ? void 0 : _d.external) || [],
|
|
31
|
-
},
|
|
32
|
-
resolve: {
|
|
33
|
-
symbole: ((_e = vite === null || vite === void 0 ? void 0 : vite.resolve) === null || _e === void 0 ? void 0 : _e.symbole) || '@',
|
|
34
|
-
alias: ((_f = vite === null || vite === void 0 ? void 0 : vite.resolve) === null || _f === void 0 ? void 0 : _f.alias) || [],
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
// Define default values for server config coming from loadedConfig.server
|
|
38
|
-
var defaultServerConfig = {
|
|
39
|
-
development: {
|
|
40
|
-
port: ((_g = server === null || server === void 0 ? void 0 : server.development) === null || _g === void 0 ? void 0 : _g.port) || undefined,
|
|
41
|
-
open: ((_h = server === null || server === void 0 ? void 0 : server.development) === null || _h === void 0 ? void 0 : _h.open) || false,
|
|
42
|
-
},
|
|
43
|
-
production: {
|
|
44
|
-
hosting: ((_j = server === null || server === void 0 ? void 0 : server.production) === null || _j === void 0 ? void 0 : _j.hosting) || "custom",
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
// Define default values for experimentals features coming from loadedConfig.experimentals
|
|
48
|
-
// const defaultExperimentalFeaturesConfig = {
|
|
49
|
-
// stream: experimental?.stream || true
|
|
50
|
-
// }
|
|
51
|
-
try {
|
|
52
|
-
var config = {
|
|
53
|
-
reactStrictMode: reactStrictMode === undefined ? true : reactStrictMode,
|
|
54
|
-
server: defaultServerConfig,
|
|
55
|
-
vite: {
|
|
56
|
-
plugins: defaultViteConfig.plugins,
|
|
57
|
-
optimizeDeps: {
|
|
58
|
-
exclude: __spreadArray([
|
|
59
|
-
"node:http",
|
|
60
|
-
"node-fetch"
|
|
61
|
-
], defaultViteConfig.optimizeDeps.exclude, true),
|
|
62
|
-
include: __spreadArray([
|
|
63
|
-
"react-fast-compare",
|
|
64
|
-
"invariant",
|
|
65
|
-
"shallowequal",
|
|
66
|
-
"react-dom/client",
|
|
67
|
-
"react-dom",
|
|
68
|
-
"react",
|
|
69
|
-
"react-router-dom",
|
|
70
|
-
"react-helmet-async"
|
|
71
|
-
], defaultViteConfig.optimizeDeps.include, true),
|
|
72
|
-
},
|
|
73
|
-
css: {
|
|
74
|
-
postcss: defaultViteConfig.css.postcss,
|
|
75
|
-
},
|
|
76
|
-
build: {
|
|
77
|
-
external: defaultViteConfig.build.external,
|
|
78
|
-
},
|
|
79
|
-
resolve: {
|
|
80
|
-
// concat two arrays
|
|
81
|
-
alias: __spreadArray([
|
|
82
|
-
{
|
|
83
|
-
find: defaultViteConfig.resolve.symbole,
|
|
84
|
-
replacement: "./src",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
find: "path",
|
|
88
|
-
replacement: "node_modules/path-browserify",
|
|
89
|
-
}
|
|
90
|
-
], defaultViteConfig.resolve.alias, true),
|
|
91
|
-
},
|
|
92
|
-
appType: "custom",
|
|
93
|
-
},
|
|
94
|
-
// experimental: defaultExperimentalFeaturesConfig,
|
|
95
|
-
// More config options...
|
|
96
|
-
};
|
|
97
|
-
return config;
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
return {
|
|
101
|
-
reactStrictMode: true,
|
|
102
|
-
vite: {
|
|
103
|
-
optimizeDeps: {
|
|
104
|
-
exclude: ["node:http", "node-fetch"],
|
|
105
|
-
include: [
|
|
106
|
-
"react-fast-compare",
|
|
107
|
-
"invariant",
|
|
108
|
-
"shallowequal",
|
|
109
|
-
"react-dom/client",
|
|
110
|
-
"react-dom",
|
|
111
|
-
"react",
|
|
112
|
-
"react-router-dom",
|
|
113
|
-
"react-helmet-async",
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
|
-
appType: "custom",
|
|
117
|
-
resolve: {
|
|
118
|
-
alias: [
|
|
119
|
-
{
|
|
120
|
-
find: "@",
|
|
121
|
-
replacement: "./src",
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
find: "path",
|
|
125
|
-
replacement: "node_modules/path-browserify",
|
|
126
|
-
},
|
|
127
|
-
],
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
// experimental: {
|
|
131
|
-
// stream: true
|
|
132
|
-
// },
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Function to adapt the path for dev and prod
|
|
138
|
-
* @param {string | Array<string>} paths
|
|
139
|
-
*/
|
|
140
|
-
export var adaptPath = function (paths) {
|
|
141
|
-
// Check if we are in dev mode or prod
|
|
142
|
-
var isProduction = process.env.NODE_ENV === "production";
|
|
143
|
-
var prefix = isProduction ? "./../../" : "";
|
|
144
|
-
// Chech if the path is an array
|
|
145
|
-
var isArray = Array.isArray(paths);
|
|
146
|
-
// If the path is an array
|
|
147
|
-
if (isArray) {
|
|
148
|
-
return paths.map(function (path) { return "".concat(process.cwd(), "/").concat(prefix).concat(path); });
|
|
149
|
-
}
|
|
150
|
-
// If the path is a string
|
|
151
|
-
return "".concat(process.cwd(), "/").concat(prefix).concat(paths);
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Adapts the provided file path to a valid URL format based on the operating system.
|
|
155
|
-
*
|
|
156
|
-
* @param path - The file path to be adapted.
|
|
157
|
-
* @returns The adapted file path in a valid URL format.
|
|
158
|
-
*/
|
|
159
|
-
export var resolvePath = function (path) {
|
|
160
|
-
// Check the OS
|
|
161
|
-
var isWindows = process.platform === "win32";
|
|
162
|
-
// Adapt the path
|
|
163
|
-
if (isWindows) {
|
|
164
|
-
return "file:///".concat(path);
|
|
165
|
-
}
|
|
166
|
-
return path;
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Asynchronously loads a module from a file path relative to the project root directory.
|
|
170
|
-
*
|
|
171
|
-
* This function checks the current environment (production or development) and adjusts the file path accordingly. It then resolves the file path to a valid URL format based on the operating system.
|
|
172
|
-
*
|
|
173
|
-
* @param filename - The name of the file to be loaded.
|
|
174
|
-
* @returns The loaded module.
|
|
175
|
-
*/
|
|
176
|
-
// export const loadAsyncFromRoot = async (filename: string) => {
|
|
177
|
-
// try {
|
|
178
|
-
// const isProduction = process.env.NODE_ENV === "production";
|
|
179
|
-
// let __pathToRoot = "";
|
|
180
|
-
// if (!isProduction) {
|
|
181
|
-
// __pathToRoot = process.cwd();
|
|
182
|
-
// } else {
|
|
183
|
-
// __pathToRoot = path.join(process.cwd(), "./../../");
|
|
184
|
-
// }
|
|
185
|
-
// const filePath = resolvePath(path.join(__pathToRoot, filename));
|
|
186
|
-
// const file = await import(`./${filePath}`);
|
|
187
|
-
// return file;
|
|
188
|
-
// } catch (error) {
|
|
189
|
-
// console.error(error);
|
|
190
|
-
// return {};
|
|
191
|
-
// }
|
|
192
|
-
// }
|
|
193
|
-
// export const getDirname = (url: string) => {
|
|
194
|
-
// // Get directory name
|
|
195
|
-
// const __dirname = dirname(fileURLToPath(url));
|
|
196
|
-
// return __dirname;
|
|
197
|
-
// }
|
|
1
|
+
import { defineConfig, adaptPath, resolvePath } from "./utils/index.js";
|
|
2
|
+
export { defineConfig, adaptPath, resolvePath };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
+
if (ar || !(i in from)) {
|
|
40
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
+
ar[i] = from[i];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Function to define the config for the app
|
|
48
|
+
* It will be used by vite.config.ts and other files in other to configure the app
|
|
49
|
+
* @param {AppConfig | AppConfigFunction | AppConfigFunctionAsync} loadedConfig
|
|
50
|
+
*/
|
|
51
|
+
export var defineConfig = function (loadedConfig) { return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var config, result, server, vite, defaultViteConfig, defaultServerConfig, config_1;
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
54
|
+
return __generator(this, function (_k) {
|
|
55
|
+
switch (_k.label) {
|
|
56
|
+
case 0:
|
|
57
|
+
if (!(typeof loadedConfig === "function")) return [3 /*break*/, 4];
|
|
58
|
+
result = loadedConfig();
|
|
59
|
+
if (!(result instanceof Promise)) return [3 /*break*/, 2];
|
|
60
|
+
return [4 /*yield*/, result];
|
|
61
|
+
case 1:
|
|
62
|
+
config = _k.sent(); // Await the promise result (AppConfigFunctionAsync)
|
|
63
|
+
return [3 /*break*/, 3];
|
|
64
|
+
case 2:
|
|
65
|
+
config = result; // Synchronous function result (AppConfigFunction)
|
|
66
|
+
_k.label = 3;
|
|
67
|
+
case 3: return [3 /*break*/, 5];
|
|
68
|
+
case 4:
|
|
69
|
+
config = loadedConfig;
|
|
70
|
+
_k.label = 5;
|
|
71
|
+
case 5:
|
|
72
|
+
server = config.server, vite = config.vite;
|
|
73
|
+
defaultViteConfig = {
|
|
74
|
+
plugins: (vite === null || vite === void 0 ? void 0 : vite.plugins) || [],
|
|
75
|
+
optimizeDeps: {
|
|
76
|
+
exclude: ((_a = vite === null || vite === void 0 ? void 0 : vite.optimizeDeps) === null || _a === void 0 ? void 0 : _a.exclude) || [],
|
|
77
|
+
include: ((_b = vite === null || vite === void 0 ? void 0 : vite.optimizeDeps) === null || _b === void 0 ? void 0 : _b.include) || [],
|
|
78
|
+
},
|
|
79
|
+
css: {
|
|
80
|
+
postcss: ((_c = vite === null || vite === void 0 ? void 0 : vite.css) === null || _c === void 0 ? void 0 : _c.postcss) || undefined,
|
|
81
|
+
},
|
|
82
|
+
build: {
|
|
83
|
+
external: ((_d = vite === null || vite === void 0 ? void 0 : vite.build) === null || _d === void 0 ? void 0 : _d.external) || [],
|
|
84
|
+
},
|
|
85
|
+
resolve: {
|
|
86
|
+
symbole: ((_e = vite === null || vite === void 0 ? void 0 : vite.resolve) === null || _e === void 0 ? void 0 : _e.symbole) || "@",
|
|
87
|
+
alias: ((_f = vite === null || vite === void 0 ? void 0 : vite.resolve) === null || _f === void 0 ? void 0 : _f.alias) || [],
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
defaultServerConfig = {
|
|
91
|
+
development: {
|
|
92
|
+
port: ((_g = server === null || server === void 0 ? void 0 : server.development) === null || _g === void 0 ? void 0 : _g.port) || undefined,
|
|
93
|
+
open: ((_h = server === null || server === void 0 ? void 0 : server.development) === null || _h === void 0 ? void 0 : _h.open) || false,
|
|
94
|
+
},
|
|
95
|
+
production: {
|
|
96
|
+
hosting: ((_j = server === null || server === void 0 ? void 0 : server.production) === null || _j === void 0 ? void 0 : _j.hosting) || "custom",
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
try {
|
|
100
|
+
config_1 = {
|
|
101
|
+
server: defaultServerConfig,
|
|
102
|
+
vite: {
|
|
103
|
+
plugins: defaultViteConfig.plugins,
|
|
104
|
+
optimizeDeps: {
|
|
105
|
+
exclude: __spreadArray([
|
|
106
|
+
"node:http",
|
|
107
|
+
"node-fetch"
|
|
108
|
+
], defaultViteConfig.optimizeDeps.exclude, true),
|
|
109
|
+
include: __spreadArray([
|
|
110
|
+
"react-fast-compare",
|
|
111
|
+
"invariant",
|
|
112
|
+
"shallowequal",
|
|
113
|
+
"react-dom/client",
|
|
114
|
+
"react-dom",
|
|
115
|
+
"react",
|
|
116
|
+
"react-router-dom",
|
|
117
|
+
"react-helmet-async"
|
|
118
|
+
], defaultViteConfig.optimizeDeps.include, true),
|
|
119
|
+
},
|
|
120
|
+
css: {
|
|
121
|
+
postcss: defaultViteConfig.css.postcss,
|
|
122
|
+
},
|
|
123
|
+
build: {
|
|
124
|
+
external: defaultViteConfig.build.external,
|
|
125
|
+
},
|
|
126
|
+
resolve: {
|
|
127
|
+
// concat two arrays
|
|
128
|
+
alias: __spreadArray([
|
|
129
|
+
{
|
|
130
|
+
find: defaultViteConfig.resolve.symbole,
|
|
131
|
+
replacement: "./src",
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
find: "path",
|
|
135
|
+
replacement: "node_modules/path-browserify",
|
|
136
|
+
}
|
|
137
|
+
], defaultViteConfig.resolve.alias, true),
|
|
138
|
+
},
|
|
139
|
+
appType: "custom",
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
return [2 /*return*/, config_1];
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return [2 /*return*/, {
|
|
146
|
+
vite: {
|
|
147
|
+
optimizeDeps: {
|
|
148
|
+
exclude: ["node:http", "node-fetch"],
|
|
149
|
+
include: [
|
|
150
|
+
"react-fast-compare",
|
|
151
|
+
"invariant",
|
|
152
|
+
"shallowequal",
|
|
153
|
+
"react-dom/client",
|
|
154
|
+
"react-dom",
|
|
155
|
+
"react",
|
|
156
|
+
"react-router-dom",
|
|
157
|
+
"react-helmet-async",
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
appType: "custom",
|
|
161
|
+
resolve: {
|
|
162
|
+
alias: [
|
|
163
|
+
{
|
|
164
|
+
find: "@",
|
|
165
|
+
replacement: "./src",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
find: "path",
|
|
169
|
+
replacement: "node_modules/path-browserify",
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
}];
|
|
175
|
+
}
|
|
176
|
+
return [2 /*return*/];
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}); };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Asynchronously loads a module from a file path.
|
|
39
|
+
*
|
|
40
|
+
* @param path - The path to the module.
|
|
41
|
+
* @returns The loaded module.
|
|
42
|
+
*/
|
|
43
|
+
export var loadModule = function (path) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var module_1, error_1;
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
switch (_a.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
_a.trys.push([0, 2, , 3]);
|
|
49
|
+
return [4 /*yield*/, import(path)];
|
|
50
|
+
case 1:
|
|
51
|
+
module_1 = _a.sent();
|
|
52
|
+
return [2 /*return*/, module_1];
|
|
53
|
+
case 2:
|
|
54
|
+
error_1 = _a.sent();
|
|
55
|
+
throw new Error(error_1);
|
|
56
|
+
case 3: return [2 /*return*/];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}); };
|
|
60
|
+
/**
|
|
61
|
+
* Asynchronously loads a module from a file path only in the server-side environment.
|
|
62
|
+
*
|
|
63
|
+
* @param path - The path to the module.
|
|
64
|
+
* @returns The loaded module.
|
|
65
|
+
*/
|
|
66
|
+
export var loadModuleSSR = function (path) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var module_2, error_2;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
switch (_a.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
_a.trys.push([0, 3, , 4]);
|
|
72
|
+
if (!(typeof window === "undefined")) return [3 /*break*/, 2];
|
|
73
|
+
return [4 /*yield*/, loadModule(path)];
|
|
74
|
+
case 1:
|
|
75
|
+
module_2 = _a.sent();
|
|
76
|
+
return [2 /*return*/, module_2];
|
|
77
|
+
case 2: return [2 /*return*/, {}];
|
|
78
|
+
case 3:
|
|
79
|
+
error_2 = _a.sent();
|
|
80
|
+
throw new Error(error_2);
|
|
81
|
+
case 4: return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}); };
|
|
85
|
+
/**
|
|
86
|
+
* Asynchronously loads a module from a file path relative to the project root directory.
|
|
87
|
+
*
|
|
88
|
+
* This function checks the current environment (production or development) and adjusts the file path accordingly. It then resolves the file path to a valid URL format based on the operating system.
|
|
89
|
+
*
|
|
90
|
+
* @param filename - The name of the file to be loaded.
|
|
91
|
+
* @returns The loaded module.
|
|
92
|
+
*/
|
|
93
|
+
// export const loadAsyncFromRoot = async (filename: string) => {
|
|
94
|
+
// try {
|
|
95
|
+
// const isProduction = process.env.NODE_ENV === "production";
|
|
96
|
+
// let __pathToRoot = "";
|
|
97
|
+
// if (!isProduction) {
|
|
98
|
+
// __pathToRoot = process.cwd();
|
|
99
|
+
// } else {
|
|
100
|
+
// __pathToRoot = path.join(process.cwd(), "./../../");
|
|
101
|
+
// }
|
|
102
|
+
// const filePath = resolvePath(path.join(__pathToRoot, filename));
|
|
103
|
+
// const file = await import(`./${filePath}`);
|
|
104
|
+
// return file;
|
|
105
|
+
// } catch (error) {
|
|
106
|
+
// console.error(error);
|
|
107
|
+
// return {};
|
|
108
|
+
// }
|
|
109
|
+
// }
|
|
110
|
+
// export const getDirname = (url: string) => {
|
|
111
|
+
// // Get directory name
|
|
112
|
+
// const __dirname = dirname(fileURLToPath(url));
|
|
113
|
+
// return __dirname;
|
|
114
|
+
// }
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to adapt the path for dev and prod
|
|
3
|
+
* @param {string | Array<string>} paths
|
|
4
|
+
*/
|
|
5
|
+
export var adaptPath = function (paths) {
|
|
6
|
+
// Check if we are in dev mode or prod
|
|
7
|
+
var isProduction = process.env.NODE_ENV === "production";
|
|
8
|
+
var prefix = isProduction ? "./../../" : "";
|
|
9
|
+
// Chech if the path is an array
|
|
10
|
+
var isArray = Array.isArray(paths);
|
|
11
|
+
// If the path is an array
|
|
12
|
+
if (isArray) {
|
|
13
|
+
return paths.map(function (path) { return "".concat(process.cwd(), "/").concat(prefix).concat(path); });
|
|
14
|
+
}
|
|
15
|
+
// If the path is a string
|
|
16
|
+
return "".concat(process.cwd(), "/").concat(prefix).concat(paths);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Adapts the provided file path to a valid URL format based on the operating system.
|
|
20
|
+
*
|
|
21
|
+
* @param path - The file path to be adapted.
|
|
22
|
+
* @returns The adapted file path in a valid URL format.
|
|
23
|
+
*/
|
|
24
|
+
export var resolvePath = function (path) {
|
|
25
|
+
// Check the OS
|
|
26
|
+
var isWindows = process.platform === "win32";
|
|
27
|
+
// Adapt the path
|
|
28
|
+
if (isWindows) {
|
|
29
|
+
return "file:///".concat(path);
|
|
30
|
+
}
|
|
31
|
+
return path;
|
|
32
|
+
};
|
|
@@ -42,7 +42,7 @@ export var Component = function (_a) {
|
|
|
42
42
|
var Router = null;
|
|
43
43
|
// Otherwise, get the router and return it
|
|
44
44
|
Router = getRouter(AppRouter);
|
|
45
|
-
return _jsx(Router, {});
|
|
45
|
+
return (_jsx(H.HelmetProvider, { children: _jsx(ErrorBoundary, { children: _jsx(Router, {}) }) }));
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
48
|
* Page component that defines title and description to a page
|
|
@@ -64,7 +64,7 @@ export var PageToRender = function (_a) {
|
|
|
64
64
|
metadatas.push(layoutMetadata);
|
|
65
65
|
return generateMetadata(metadatas);
|
|
66
66
|
}, []);
|
|
67
|
-
return (_jsxs(React.Fragment, { children: [_jsxs(H.Helmet, { children: [metaTags.map(function (meta) { return meta; }), _jsx("meta", { name:
|
|
67
|
+
return (_jsxs(React.Fragment, { children: [_jsxs(H.Helmet, { children: [metaTags.map(function (meta) { return meta; }), _jsx("meta", { name: 'description', content: ((_b = Page.metadata) === null || _b === void 0 ? void 0 : _b.description) || "" }), _jsx("title", { children: ((_c = Page.metadata) === null || _c === void 0 ? void 0 : _c.title) || Page.name })] }), _jsx(Page, __assign({}, finalProps))] }));
|
|
68
68
|
};
|
|
69
69
|
/**
|
|
70
70
|
* Error fallback component that will be displayed if an error occurs
|
|
@@ -118,7 +118,7 @@ export var Heads = function (_a) {
|
|
|
118
118
|
var data = _a.data, _b = _a.children, children = _b === void 0 ? undefined : _b, _c = _a.bootstrap, bootstrap = _c === void 0 ? "" : _c, _d = _a.styles, styles = _d === void 0 ? "" : _d;
|
|
119
119
|
if (!data)
|
|
120
120
|
return null;
|
|
121
|
-
return (_jsxs("head", { children: [children, data.helmet && data.helmet.meta.toComponent({}), data.helmet && data.helmet.title.toComponent({}), bootstrap && (_jsx("script", { type:
|
|
121
|
+
return (_jsxs("head", { children: [children, data.helmet && data.helmet.meta.toComponent({}), data.helmet && data.helmet.title.toComponent({}), bootstrap && (_jsx("script", { type: 'module', src: bootstrap, defer: true })), styles && (_jsx("link", { rel: 'stylesheet', crossOrigin: '', type: 'text/css', href: styles }))] }));
|
|
122
122
|
};
|
|
123
123
|
/**
|
|
124
124
|
* Body component
|
|
@@ -127,7 +127,7 @@ export var Body = function (_a) {
|
|
|
127
127
|
var _b = _a.children, children = _b === void 0 ? undefined : _b, _c = _a.asChild, asChild = _c === void 0 ? false : _c, _d = _a.AppContent, AppContent = _d === void 0 ? undefined : _d;
|
|
128
128
|
return (_jsxs("body", { children: [_jsx("noscript", { dangerouslySetInnerHTML: {
|
|
129
129
|
__html: "<b>Enable JavaScript to run this app.</b>",
|
|
130
|
-
} }), asChild ? (_jsx("div", { id: 'root', children: AppContent })) : (_jsx("div", { id:
|
|
130
|
+
} }), asChild ? (_jsx("div", { id: 'root', children: AppContent })) : (_jsx("div", { id: 'root', children: "rasengan-body-app" })), children] }));
|
|
131
131
|
};
|
|
132
132
|
/**
|
|
133
133
|
* Scripts component
|
|
@@ -138,7 +138,7 @@ export var Scripts = function (_a) {
|
|
|
138
138
|
if (typeof exports === "object" && typeof module !== "undefined") {
|
|
139
139
|
folder = "cjs";
|
|
140
140
|
}
|
|
141
|
-
return (_jsxs(React.Fragment, { children: [bootstrap === "" && (_jsx("script", { type:
|
|
141
|
+
return (_jsxs(React.Fragment, { children: [bootstrap === "" && (_jsx("script", { type: 'module', src: "/node_modules/rasengan/lib/".concat(folder, "/entries/entry-client.js"), defer: true })), children] }));
|
|
142
142
|
};
|
|
143
143
|
/**
|
|
144
144
|
* Default layout component
|
|
@@ -3,10 +3,5 @@ import React from "react";
|
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
import App from "./../../../../../src/main";
|
|
6
|
-
import { Component
|
|
7
|
-
|
|
8
|
-
import config from "./../../../../../rasengan.config.js";
|
|
9
|
-
import * as HelmetAsync from "react-helmet-async";
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
var H = HelmetAsync.default ? HelmetAsync.default : HelmetAsync;
|
|
12
|
-
ReactDOM.hydrateRoot(document.getElementById("root"), config.reactStrictMode ? (_jsx(React.StrictMode, { children: _jsx(H.HelmetProvider, { children: _jsx(ErrorBoundary, { children: _jsx(App, { Component: Component }) }) }) })) : (_jsx(H.HelmetProvider, { children: _jsx(ErrorBoundary, { children: _jsx(App, { Component: Component }) }) })));
|
|
6
|
+
import { Component } from "../core/components/index.js";
|
|
7
|
+
ReactDOM.hydrateRoot(document.getElementById("root"), _jsx(App, { Component: Component, StrictMode: React.StrictMode }));
|
|
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g =
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
13
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
14
|
function step(op) {
|
|
15
15
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -60,7 +60,7 @@ var RenderApp = function (_a) {
|
|
|
60
60
|
return (_jsxs(Heads, { data: helmetContext, styles: styles, bootstrap: bootstrap, children: [viteScripts, children] }));
|
|
61
61
|
}, Body: function (_a) {
|
|
62
62
|
var children = _a.children;
|
|
63
|
-
return (_jsx(Body, { asChild: true, AppContent: _jsx(App, { Component: Component, children: _jsx(StaticRouterProvider, { router: router, context: context }) }), children: children }));
|
|
63
|
+
return (_jsx(Body, { asChild: true, AppContent: _jsx(App, { Component: Component, StrictMode: React.StrictMode, children: _jsx(StaticRouterProvider, { router: router, context: context }) }), children: children }));
|
|
64
64
|
}, Script: function (_a) {
|
|
65
65
|
var children = _a.children;
|
|
66
66
|
return (_jsx(Scripts, { bootstrap: bootstrap, children: children }));
|