rpc4next 0.2.3 → 0.2.4

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.
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.handleCli = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const constants_1 = require("./constants");
9
+ const path_utils_1 = require("./core/path-utils");
9
10
  const generator_1 = require("./generator");
10
11
  const watcher_1 = require("./watcher");
11
12
  const handleGenerateSafely = (baseDir, outputPath, paramsFileName, logger) => {
@@ -29,8 +30,8 @@ const handleGenerateSafely = (baseDir, outputPath, paramsFileName, logger) => {
29
30
  }
30
31
  };
31
32
  const handleCli = (baseDir, outputPath, options, logger) => {
32
- const resolvedBaseDir = path_1.default.resolve(baseDir).replace(/\\/g, "/");
33
- const resolvedOutputPath = path_1.default.resolve(outputPath).replace(/\\/g, "/");
33
+ const resolvedBaseDir = (0, path_utils_1.toPosixPath)(path_1.default.resolve(baseDir));
34
+ const resolvedOutputPath = (0, path_utils_1.toPosixPath)(path_1.default.resolve(outputPath));
34
35
  const paramsFileName = typeof options.paramsFile === "string" ? options.paramsFile : null;
35
36
  if (options.paramsFile !== undefined && !paramsFileName) {
36
37
  logger.error("Error: --params-file requires a filename.");
@@ -1 +1,2 @@
1
1
  export declare const createRelativeImportPath: (outputFile: string, inputFile: string) => string;
2
+ export declare const toPosixPath: (p: string) => string;
@@ -3,13 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createRelativeImportPath = void 0;
6
+ exports.toPosixPath = exports.createRelativeImportPath = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const createRelativeImportPath = (outputFile, inputFile) => {
9
- let relativePath = path_1.default
10
- .relative(path_1.default.dirname(outputFile), inputFile)
11
- .replace(/\\/g, "/")
12
- .replace(/\.tsx?$/, "");
9
+ let relativePath = (0, exports.toPosixPath)(path_1.default.relative(path_1.default.dirname(outputFile), inputFile)).replace(/\.tsx?$/, "");
13
10
  // Add "./" if the file is in the same directory
14
11
  if (!relativePath.startsWith("../")) {
15
12
  relativePath = "./" + relativePath;
@@ -17,3 +14,7 @@ const createRelativeImportPath = (outputFile, inputFile) => {
17
14
  return relativePath;
18
15
  };
19
16
  exports.createRelativeImportPath = createRelativeImportPath;
17
+ const toPosixPath = (p) => {
18
+ return p.replace(/\\/g, "/");
19
+ };
20
+ exports.toPosixPath = toPosixPath;
@@ -16,6 +16,7 @@ const scan_utils_1 = require("./scan-utils");
16
16
  const type_utils_1 = require("./type-utils");
17
17
  const constants_2 = require("../../lib/constants");
18
18
  const constants_3 = require("../constants");
19
+ const path_utils_1 = require("./path-utils");
19
20
  const endPointFileNames = new Set(constants_3.END_POINT_FILE_NAMES);
20
21
  const hasTargetFiles = (dirPath) => {
21
22
  if (cache_1.visitedDirsCache.has(dirPath))
@@ -88,7 +89,7 @@ const scanAppDir = (output, input, indent = "", parentParams = []) => {
88
89
  })
89
90
  .sort();
90
91
  for (const entry of entries) {
91
- const fullPath = path_1.default.join(input, entry.name).replace(/\\/g, "/");
92
+ const fullPath = (0, path_utils_1.toPosixPath)(path_1.default.join(input, entry.name));
92
93
  if (entry.isDirectory()) {
93
94
  const entryName = entry.name;
94
95
  const isGroup = entryName.startsWith("(") && entryName.endsWith(")");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rpc4next",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Inspired by Hono RPC and Pathpida, rpc4next brings a lightweight and intuitive RPC solution to Next.js, making server-client communication seamless",
5
5
  "author": "watanabe-1",
6
6
  "license": "MIT",