🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

next-rsc-error-handler

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-rsc-error-handler - npm Package Compare versions

Comparing version

to
0.4.0

src/ts-path-alias.js

5

package.json
{
"name": "next-rsc-error-handler",
"version": "0.3.4",
"version": "0.4.0",
"description": "Webpack plugin that allow to handle RSC errors on the server side",

@@ -31,4 +31,5 @@ "main": "./src/index.js",

"client-only": "^0.0.1",
"server-only": "^0.0.1"
"server-only": "^0.0.1",
"typescript": "~5.4.5"
}
}

19

src/loader.js

@@ -5,3 +5,2 @@ import parser from "@babel/parser";

import * as t from "@babel/types";
import path from "node:path";

@@ -15,2 +14,3 @@ import {

} from "./utils.js";
import { resolveTsAlias } from "./ts-path-alias.js";

@@ -42,5 +42,10 @@ const WRAPPER_NAME = "__rscWrapper";

const getImportRelativePath = (p) => {
const val = resolveTsAlias(p.node.source.value);
return getRelativePath(this.utils.absolutify(this.context, val));
};
traverse.default(ast, {
ImportDeclaration(p) {
clientComponents.add(getImportRelativePath(resourcePath, p));
clientComponents.add(getImportRelativePath(p));
},

@@ -154,11 +159,3 @@ // TODO add FunctionExpression

function dropExtension(relativePath) {
return relativePath.replace(/\.[^/.]+$/, "");
return relativePath.replace(/\.[^\/.]+$/, "");
}
function getImportRelativePath(resourcePath, p) {
return dropExtension(
getRelativePath(
path.resolve(path.dirname(resourcePath), p.node.source.value)
)
);
}