Repository: swc-project/swc (rust)

Issue:
connot find module '@swc/core/VIsitor.js'
### Describe the bug

Error wher install @swc/core@1.5.22
<img width="832" alt="0zm4y12000e8lmighD16B" src="https://github.com/swc-project/swc/assets/10055044/e6ccc58b-750b-49c6-9218-040aa44453ed">


### Input code

```typescript
npm install @swc/core/VIsitor.js
```


### Config

_No response_

### Playground link (or link to the minimal reproduction)

https://play.swc.rs/

### SWC Info output

_No response_

### Expected behavior

No error

### Actual behavior

_No response_

### Version

1.5.22

### Additional context

_No response_

Pull request:
fix(bindings/node): Fix regression of JS APIs
**Description:**


**Related issue:**

 - Closes #8997

Patch:
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 9c481b2f2c..81b54c2d0b 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -23,7 +23,7 @@ const bindings: typeof import("../binding") = (() => {
     try {
         binding = !!bindingsOverride
             ? require(resolve(bindingsOverride))
-            : require("../binding.js");
+            : require("./binding.js");
 
         // If native binding loaded successfully, it should return proper target triple constant.
         const triple = binding.getTargetTriple();
@@ -40,7 +40,7 @@ const bindings: typeof import("../binding") = (() => {
 /**
  * Version of the swc binding.
  */
-export const version: string = require("../package.json").version;
+export const version: string = require("./package.json").version;
 
 /**
  * @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
diff --git a/packages/core/postinstall.ts b/packages/core/src/postinstall.ts
similarity index 100%
rename from packages/core/postinstall.ts
rename to packages/core/src/postinstall.ts
diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json
index dabc09203f..7dcfab7612 100644
--- a/packages/core/tsconfig.json
+++ b/packages/core/tsconfig.json
@@ -12,7 +12,7 @@
         "sourceMap": false /* Generates corresponding '.map' file. */,
         // "outFile": "./",                       /* Concatenate and emit output to single file. */
         "outDir": "./" /* Redirect output structure to the directory. */,
-        "rootDir": "./" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
+        "rootDir": "./src/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
         // "composite": true,                     /* Enable project compilation */
         "removeComments": false /* Do not emit comments to output. */,
         // "noEmit": true,                        /* Do not emit outputs. */


Test patch:
diff --git a/packages/core/__tests__/plugin_test.mjs b/packages/core/__tests__/plugin_test.mjs
index 757a9c4abe..13fd13e415 100644
--- a/packages/core/__tests__/plugin_test.mjs
+++ b/packages/core/__tests__/plugin_test.mjs
@@ -1,5 +1,5 @@
 import swc from "..";
-import Visitor from "../src/Visitor";
+import Visitor from "../Visitor";
 
 function assertAllObjectHasTypeFiled(obj, desc = '') {
     if (Array.isArray(obj)) {
diff --git a/packages/core/__tests__/transform/plugin_test.js b/packages/core/__tests__/transform/plugin_test.js
index 9ff7fef506..21be091f3e 100644
--- a/packages/core/__tests__/transform/plugin_test.js
+++ b/packages/core/__tests__/transform/plugin_test.js
@@ -1,5 +1,5 @@
 const swc = require("../../");
-const Visitor = require("../../src/Visitor").default;
+const Visitor = require("../../Visitor").default;
 
 {
     const src = `