rasengan 1.0.0-beta.38 → 1.0.0-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.
@@ -51,6 +51,7 @@ import { Command } from "commander";
51
51
  import { execa } from "execa";
52
52
  // @ts-ignore
53
53
  import path from "node:path";
54
+ import { resolvePath } from "../config/index.js";
54
55
  var program = new Command();
55
56
  program
56
57
  .name(chalk.blue("rasengan"))
@@ -95,7 +96,7 @@ program
95
96
  .command("prepare")
96
97
  .description("Prepare the project")
97
98
  .action(function () { return __awaiter(void 0, void 0, void 0, function () {
98
- var appConfig, server, hostingStrategy;
99
+ var configPath, appConfig, server, hostingStrategy;
99
100
  var _a, _b;
100
101
  return __generator(this, function (_c) {
101
102
  switch (_c.label) {
@@ -104,7 +105,8 @@ program
104
105
  console.log("");
105
106
  console.log(chalk.blue("Preparing your project for production..."));
106
107
  console.log("");
107
- return [4 /*yield*/, import(path.join(process.cwd(), "rasengan.config.js"))];
108
+ configPath = resolvePath(path.join(process.cwd(), "rasengan.config.js"));
109
+ return [4 /*yield*/, import(configPath)];
108
110
  case 1:
109
111
  appConfig = _c.sent();
110
112
  server = appConfig.server;
@@ -150,3 +150,18 @@ export var adaptPath = function (paths) {
150
150
  // If the path is a string
151
151
  return "".concat(process.cwd(), "/").concat(prefix).concat(paths);
152
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
+ };
@@ -64,3 +64,10 @@ export declare const defineConfig: (loadedConfig: AppConfig) => {
64
64
  * @param {string | Array<string>} paths
65
65
  */
66
66
  export declare const adaptPath: (paths: string | Array<string>) => string | string[];
67
+ /**
68
+ * Adapts the provided file path to a valid URL format based on the operating system.
69
+ *
70
+ * @param path - The file path to be adapted.
71
+ * @returns The adapted file path in a valid URL format.
72
+ */
73
+ export declare const resolvePath: (path: string) => string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rasengan",
3
3
  "private": false,
4
- "version": "1.0.0-beta.38",
4
+ "version": "1.0.0-beta.39",
5
5
  "description": "The modern frontend framework for React",
6
6
  "type": "module",
7
7
  "main": "lib/esm/index.js",
package/server.js CHANGED
@@ -16,6 +16,9 @@ import {
16
16
  fix404,
17
17
  } from "./lib/esm/server/utils/index.js";
18
18
 
19
+ // Resolve path
20
+ import { resolvePath } from "./lib/esm/config/index.js";
21
+
19
22
  /**
20
23
  * This function is responsible for creating a server for the development environment.
21
24
  * @param {boolean} isProduction - Whether the server is in production mode or not.
@@ -81,7 +84,9 @@ async function createServer({
81
84
  join(appPath, `node_modules/rasengan/lib/esm/entries/entry-server.js`)
82
85
  );
83
86
  } else {
84
- entry = await import(join(appPath, "dist/server/entry-server.js"));
87
+ entry = await import(
88
+ resolvePath(join(appPath, "dist/server/entry-server.js"))
89
+ );
85
90
 
86
91
  // replace bootstrap script with compiled scripts
87
92
  bootstrap =
@@ -243,15 +248,16 @@ async function createServer({
243
248
  // Constants
244
249
  const isProduction = process.env.NODE_ENV === "production";
245
250
 
246
- // Get config
247
- const config = (
248
- await import(
249
- join(
250
- isProduction ? process.cwd() + "./../../" : process.cwd(),
251
- "rasengan.config.js"
252
- )
251
+ // Format config path
252
+ const configPath = resolvePath(
253
+ join(
254
+ isProduction ? process.cwd() + "./../../" : process.cwd(),
255
+ "rasengan.config.js"
253
256
  )
254
- ).default;
257
+ );
258
+
259
+ // Get config
260
+ const config = (await import(configPath)).default;
255
261
 
256
262
  const port = !isProduction
257
263
  ? (process.env.PORT && Number(process.env.PORT)) ||