rasengan 1.0.0-beta.20 → 1.0.0-beta.22

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.
@@ -41,23 +41,26 @@ import { createStaticHandler, createStaticRouter, } from "react-router-dom/serve
41
41
  // @ts-ignore
42
42
  import { createFetchRequest } from "rasengan";
43
43
  import { fileURLToPath } from "node:url";
44
- var __filename = fileURLToPath(import.meta.url);
45
- var __dirname = dirname(__filename);
46
44
  // Create server for production only
47
45
  export default function handleRequest(req, res) {
48
46
  var _a;
49
47
  return __awaiter(this, void 0, void 0, function () {
50
- var url, host, appPath, err_1, templateHtml, serverFilePath, bootstrapDirPath, entry, bootstrap, styles, render, staticRoutes, loadTemplateHtml, handler, fetchRequest, context, status_1, redirect, helmetContext, router, rendered, html, e_1;
48
+ var __customDirname, __filename_1, __customDirname_1, url, host, appPath, err_1, templateHtml, serverFilePath, bootstrapDirPath, entry, bootstrap, styles, render, staticRoutes, loadTemplateHtml, handler, fetchRequest, context, status_1, redirect, helmetContext, router, rendered, html, e_1;
51
49
  return __generator(this, function (_b) {
52
50
  switch (_b.label) {
53
51
  case 0:
52
+ __customDirname = "";
53
+ if (__dirname === undefined) {
54
+ __filename_1 = fileURLToPath(import.meta.url);
55
+ __customDirname_1 = dirname(__filename_1);
56
+ }
54
57
  console.log({
55
58
  cwd: process.cwd(),
56
- __dirname: __dirname
59
+ __customDirname: __customDirname
57
60
  });
58
61
  // read dir
59
62
  console.log({
60
- readdir: fsSync.readdirSync(__dirname),
63
+ readdir: fsSync.readdirSync(__customDirname),
61
64
  readdir2: fsSync.readdirSync(join(process.cwd(), "..")),
62
65
  readdir3: fsSync.readdirSync(join(process.cwd(), "..", "..")),
63
66
  });
@@ -66,7 +69,7 @@ export default function handleRequest(req, res) {
66
69
  _b.trys.push([1, 9, , 10]);
67
70
  url = req.url;
68
71
  host = req.headers.host;
69
- appPath = join(process.cwd(), "..");
72
+ appPath = join(__dirname || __customDirname, "..");
70
73
  if (!(url === "/robots.txt")) return [3 /*break*/, 5];
71
74
  _b.label = 2;
72
75
  case 2:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rasengan",
3
3
  "private": false,
4
- "version": "1.0.0-beta.20",
4
+ "version": "1.0.0-beta.22",
5
5
  "description": "The modern frontend framework for React",
6
6
  "type": "module",
7
7
  "main": "lib/esm/index.js",