@bleedingdev/modern-js-server-utils 3.5.0-ultramodern.1 → 3.5.0-ultramodern.10

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.
@@ -144,6 +144,20 @@ const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
144
144
  resolve(result);
145
145
  });
146
146
  });
147
+ const getTsgoBinEntry = (pkg)=>{
148
+ if ('string' == typeof pkg.bin) return pkg.bin;
149
+ return pkg.bin?.tsgo;
150
+ };
151
+ const resolveTsgoBinPath = (pkgPath)=>{
152
+ const pkgDir = external_path_default().dirname(pkgPath);
153
+ const pkg = require(pkgPath);
154
+ const declaredBinEntry = getTsgoBinEntry(pkg);
155
+ const candidates = [
156
+ declaredBinEntry ? external_path_default().resolve(pkgDir, declaredBinEntry) : void 0,
157
+ external_path_default().join(pkgDir, 'bin/tsgo.js')
158
+ ].filter((candidate)=>Boolean(candidate));
159
+ return candidates.find((candidate)=>utils_namespaceObject.fs.existsSync(candidate)) ?? candidates[0];
160
+ };
147
161
  const getTsgoBinPath = (appDirectory, resolvePaths = [
148
162
  appDirectory,
149
163
  __dirname
@@ -152,7 +166,7 @@ const getTsgoBinPath = (appDirectory, resolvePaths = [
152
166
  const pkgPath = require.resolve("@typescript/native-preview/package.json", {
153
167
  paths: resolvePaths
154
168
  });
155
- return external_path_default().join(external_path_default().dirname(pkgPath), 'bin/tsgo.js');
169
+ return resolveTsgoBinPath(pkgPath);
156
170
  } catch {
157
171
  throw new Error('tsgo could not be found! Please install "@typescript/native-preview" in your project to compile BFF/server code.');
158
172
  }
@@ -99,6 +99,20 @@ const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
99
99
  resolve(result);
100
100
  });
101
101
  });
102
+ const getTsgoBinEntry = (pkg)=>{
103
+ if ('string' == typeof pkg.bin) return pkg.bin;
104
+ return pkg.bin?.tsgo;
105
+ };
106
+ const resolveTsgoBinPath = (pkgPath)=>{
107
+ const pkgDir = path.dirname(pkgPath);
108
+ const pkg = require(pkgPath);
109
+ const declaredBinEntry = getTsgoBinEntry(pkg);
110
+ const candidates = [
111
+ declaredBinEntry ? path.resolve(pkgDir, declaredBinEntry) : void 0,
112
+ path.join(pkgDir, 'bin/tsgo.js')
113
+ ].filter((candidate)=>Boolean(candidate));
114
+ return candidates.find((candidate)=>fs.existsSync(candidate)) ?? candidates[0];
115
+ };
102
116
  const getTsgoBinPath = (appDirectory, resolvePaths = [
103
117
  appDirectory,
104
118
  __dirname
@@ -107,7 +121,7 @@ const getTsgoBinPath = (appDirectory, resolvePaths = [
107
121
  const pkgPath = require.resolve("@typescript/native-preview/package.json", {
108
122
  paths: resolvePaths
109
123
  });
110
- return path.join(path.dirname(pkgPath), 'bin/tsgo.js');
124
+ return resolveTsgoBinPath(pkgPath);
111
125
  } catch {
112
126
  throw new Error('tsgo could not be found! Please install "@typescript/native-preview" in your project to compile BFF/server code.');
113
127
  }
@@ -7,7 +7,7 @@ import { rewriteImportSpecifiers } from "./importRewriter.mjs";
7
7
  import { createTsconfigPathsMatcher, getNotAliasedPath } from "./tsconfigPathsPlugin.mjs";
8
8
  import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
9
9
  import { dirname as __rspack_dirname } from "node:path";
10
- var typescript_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
10
+ var __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
11
11
  const copyFiles = async (from, to, appDirectory)=>{
12
12
  if (await fs.pathExists(from)) {
13
13
  const relativePath = path.relative(appDirectory, from);
@@ -104,15 +104,29 @@ const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
104
104
  resolve(result);
105
105
  });
106
106
  });
107
+ const getTsgoBinEntry = (pkg)=>{
108
+ if ('string' == typeof pkg.bin) return pkg.bin;
109
+ return pkg.bin?.tsgo;
110
+ };
111
+ const resolveTsgoBinPath = (pkgPath)=>{
112
+ const pkgDir = path.dirname(pkgPath);
113
+ const pkg = require(pkgPath);
114
+ const declaredBinEntry = getTsgoBinEntry(pkg);
115
+ const candidates = [
116
+ declaredBinEntry ? path.resolve(pkgDir, declaredBinEntry) : void 0,
117
+ path.join(pkgDir, 'bin/tsgo.js')
118
+ ].filter((candidate)=>Boolean(candidate));
119
+ return candidates.find((candidate)=>fs.existsSync(candidate)) ?? candidates[0];
120
+ };
107
121
  const getTsgoBinPath = (appDirectory, resolvePaths = [
108
122
  appDirectory,
109
- typescript_dirname
123
+ __rspack_import_meta_dirname__
110
124
  ])=>{
111
125
  try {
112
126
  const pkgPath = require.resolve("@typescript/native-preview/package.json", {
113
127
  paths: resolvePaths
114
128
  });
115
- return path.join(path.dirname(pkgPath), 'bin/tsgo.js');
129
+ return resolveTsgoBinPath(pkgPath);
116
130
  } catch {
117
131
  throw new Error('tsgo could not be found! Please install "@typescript/native-preview" in your project to compile BFF/server code.');
118
132
  }
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.5.0-ultramodern.1",
20
+ "version": "3.5.0-ultramodern.10",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -40,17 +40,17 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@swc/helpers": "^0.5.23",
43
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.1"
43
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.10"
44
44
  },
45
45
  "devDependencies": {
46
- "@rslib/core": "0.23.0",
46
+ "@rslib/core": "0.23.1",
47
47
  "@types/node": "^26.0.1",
48
- "@typescript/native-preview": "7.0.0-dev.20260624.1",
49
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.1",
50
- "@scripts/rstest-config": "2.66.0"
48
+ "@typescript/native-preview": "7.0.0-dev.20260628.1",
49
+ "@scripts/rstest-config": "2.66.0",
50
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.10"
51
51
  },
52
52
  "peerDependencies": {
53
- "@typescript/native-preview": ">=7.0.0-dev.20260624.1"
53
+ "@typescript/native-preview": ">=7.0.0-dev.20260628.1"
54
54
  },
55
55
  "peerDependenciesMeta": {
56
56
  "@typescript/native-preview": {