rpc4next 0.2.5 → 0.2.7
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.
|
@@ -3,7 +3,7 @@ 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.toPosixPath = exports.createRelativeImportPath = void 0;
|
|
6
|
+
exports.relativeFromRoot = exports.toPosixPath = exports.createRelativeImportPath = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const createRelativeImportPath = (outputFile, inputFile) => {
|
|
9
9
|
let relativePath = (0, exports.toPosixPath)(path_1.default.relative(path_1.default.dirname(outputFile), inputFile)).replace(/\.tsx?$/, "");
|
|
@@ -18,3 +18,7 @@ const toPosixPath = (p) => {
|
|
|
18
18
|
return p.replace(/\\/g, "/");
|
|
19
19
|
};
|
|
20
20
|
exports.toPosixPath = toPosixPath;
|
|
21
|
+
const relativeFromRoot = (filePath) => {
|
|
22
|
+
return path_1.default.relative(process.cwd(), filePath);
|
|
23
|
+
};
|
|
24
|
+
exports.relativeFromRoot = relativeFromRoot;
|
package/dist/cli/generator.js
CHANGED
|
@@ -8,12 +8,13 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const constants_1 = require("./constants");
|
|
10
10
|
const generate_path_structure_1 = require("./core/generate-path-structure");
|
|
11
|
+
const path_utils_1 = require("./core/path-utils");
|
|
11
12
|
const logger_1 = require("./logger");
|
|
12
13
|
const generate = ({ baseDir, outputPath, paramsFileName, logger, }) => {
|
|
13
14
|
logger.info("Generating types...", { event: "generate" });
|
|
14
15
|
const { pathStructure, paramsTypes } = (0, generate_path_structure_1.generatePages)(outputPath, baseDir);
|
|
15
16
|
fs_1.default.writeFileSync(outputPath, pathStructure);
|
|
16
|
-
logger.success((0, logger_1.padMessage)("Path structure type",
|
|
17
|
+
logger.success((0, logger_1.padMessage)("Path structure type", (0, path_utils_1.relativeFromRoot)(outputPath), constants_1.SUCCESS_SEPARATOR, constants_1.SUCCESS_PAD_LENGTH), { indentLevel: constants_1.SUCCESS_INDENT_LEVEL });
|
|
17
18
|
if (paramsFileName) {
|
|
18
19
|
paramsTypes.forEach(({ paramsType, dirPath }) => {
|
|
19
20
|
const filePath = path_1.default.join(dirPath, paramsFileName);
|
package/dist/cli/watcher.js
CHANGED
|
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.setupWatcher = void 0;
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
7
|
const chokidar_1 = __importDefault(require("chokidar"));
|
|
9
8
|
const constants_1 = require("./constants");
|
|
10
9
|
const cache_1 = require("./core/cache");
|
|
10
|
+
const path_utils_1 = require("./core/path-utils");
|
|
11
11
|
const debounce_1 = require("./debounce");
|
|
12
12
|
const setupWatcher = (baseDir, onGenerate, logger) => {
|
|
13
|
-
logger.info(`${
|
|
13
|
+
logger.info(`${(0, path_utils_1.relativeFromRoot)(baseDir)}`, {
|
|
14
14
|
event: "watch",
|
|
15
15
|
});
|
|
16
16
|
const isTargetFiles = (path) => constants_1.END_POINT_FILE_NAMES.some((fileName) => path.endsWith(fileName));
|
|
@@ -36,7 +36,7 @@ const setupWatcher = (baseDir, onGenerate, logger) => {
|
|
|
36
36
|
debouncedGenerate();
|
|
37
37
|
watcher.on("all", (event, filePath) => {
|
|
38
38
|
if (isTargetFiles(filePath)) {
|
|
39
|
-
const relativePath =
|
|
39
|
+
const relativePath = (0, path_utils_1.relativeFromRoot)(filePath);
|
|
40
40
|
logger.info(relativePath, { event });
|
|
41
41
|
changedPaths.add(filePath);
|
|
42
42
|
debouncedGenerate();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rpc4next",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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",
|