@bleedingdev/modern-js-server-utils 3.5.0-ultramodern.5 → 3.5.0-ultramodern.75

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.
@@ -74,10 +74,17 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
74
74
  config.compilerOptions ??= {};
75
75
  config.compilerOptions.rootDir = appDirectory;
76
76
  config.compilerOptions.outDir = distDir;
77
+ config.compilerOptions.composite = false;
78
+ config.compilerOptions.declaration = false;
79
+ config.compilerOptions.declarationMap = false;
80
+ config.compilerOptions.emitDeclarationOnly = false;
81
+ config.compilerOptions.incremental = false;
77
82
  config.compilerOptions.noEmit = false;
83
+ delete config.compilerOptions.tsBuildInfoFile;
78
84
  if (true === config.compilerOptions.allowImportingTsExtensions) config.compilerOptions.rewriteRelativeImportExtensions = true;
79
85
  config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files);
80
86
  delete config.include;
87
+ delete config.references;
81
88
  delete config.compilerOptions.baseUrl;
82
89
  if ([
83
90
  'node',
@@ -144,6 +151,20 @@ const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
144
151
  resolve(result);
145
152
  });
146
153
  });
154
+ const getTsgoBinEntry = (pkg)=>{
155
+ if ('string' == typeof pkg.bin) return pkg.bin;
156
+ return pkg.bin?.tsgo;
157
+ };
158
+ const resolveTsgoBinPath = (pkgPath)=>{
159
+ const pkgDir = external_path_default().dirname(pkgPath);
160
+ const pkg = require(pkgPath);
161
+ const declaredBinEntry = getTsgoBinEntry(pkg);
162
+ const candidates = [
163
+ declaredBinEntry ? external_path_default().resolve(pkgDir, declaredBinEntry) : void 0,
164
+ external_path_default().join(pkgDir, 'bin/tsgo.js')
165
+ ].filter((candidate)=>Boolean(candidate));
166
+ return candidates.find((candidate)=>utils_namespaceObject.fs.existsSync(candidate)) ?? candidates[0];
167
+ };
147
168
  const getTsgoBinPath = (appDirectory, resolvePaths = [
148
169
  appDirectory,
149
170
  __dirname
@@ -152,7 +173,7 @@ const getTsgoBinPath = (appDirectory, resolvePaths = [
152
173
  const pkgPath = require.resolve("@typescript/native-preview/package.json", {
153
174
  paths: resolvePaths
154
175
  });
155
- return external_path_default().join(external_path_default().dirname(pkgPath), 'bin/tsgo.js');
176
+ return resolveTsgoBinPath(pkgPath);
156
177
  } catch {
157
178
  throw new Error('tsgo could not be found! Please install "@typescript/native-preview" in your project to compile BFF/server code.');
158
179
  }
@@ -29,10 +29,17 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
29
29
  config.compilerOptions ??= {};
30
30
  config.compilerOptions.rootDir = appDirectory;
31
31
  config.compilerOptions.outDir = distDir;
32
+ config.compilerOptions.composite = false;
33
+ config.compilerOptions.declaration = false;
34
+ config.compilerOptions.declarationMap = false;
35
+ config.compilerOptions.emitDeclarationOnly = false;
36
+ config.compilerOptions.incremental = false;
32
37
  config.compilerOptions.noEmit = false;
38
+ delete config.compilerOptions.tsBuildInfoFile;
33
39
  if (true === config.compilerOptions.allowImportingTsExtensions) config.compilerOptions.rewriteRelativeImportExtensions = true;
34
40
  config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files);
35
41
  delete config.include;
42
+ delete config.references;
36
43
  delete config.compilerOptions.baseUrl;
37
44
  if ([
38
45
  'node',
@@ -99,6 +106,20 @@ const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
99
106
  resolve(result);
100
107
  });
101
108
  });
109
+ const getTsgoBinEntry = (pkg)=>{
110
+ if ('string' == typeof pkg.bin) return pkg.bin;
111
+ return pkg.bin?.tsgo;
112
+ };
113
+ const resolveTsgoBinPath = (pkgPath)=>{
114
+ const pkgDir = path.dirname(pkgPath);
115
+ const pkg = require(pkgPath);
116
+ const declaredBinEntry = getTsgoBinEntry(pkg);
117
+ const candidates = [
118
+ declaredBinEntry ? path.resolve(pkgDir, declaredBinEntry) : void 0,
119
+ path.join(pkgDir, 'bin/tsgo.js')
120
+ ].filter((candidate)=>Boolean(candidate));
121
+ return candidates.find((candidate)=>fs.existsSync(candidate)) ?? candidates[0];
122
+ };
102
123
  const getTsgoBinPath = (appDirectory, resolvePaths = [
103
124
  appDirectory,
104
125
  __dirname
@@ -107,7 +128,7 @@ const getTsgoBinPath = (appDirectory, resolvePaths = [
107
128
  const pkgPath = require.resolve("@typescript/native-preview/package.json", {
108
129
  paths: resolvePaths
109
130
  });
110
- return path.join(path.dirname(pkgPath), 'bin/tsgo.js');
131
+ return resolveTsgoBinPath(pkgPath);
111
132
  } catch {
112
133
  throw new Error('tsgo could not be found! Please install "@typescript/native-preview" in your project to compile BFF/server code.');
113
134
  }
@@ -34,10 +34,17 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
34
34
  config.compilerOptions ??= {};
35
35
  config.compilerOptions.rootDir = appDirectory;
36
36
  config.compilerOptions.outDir = distDir;
37
+ config.compilerOptions.composite = false;
38
+ config.compilerOptions.declaration = false;
39
+ config.compilerOptions.declarationMap = false;
40
+ config.compilerOptions.emitDeclarationOnly = false;
41
+ config.compilerOptions.incremental = false;
37
42
  config.compilerOptions.noEmit = false;
43
+ delete config.compilerOptions.tsBuildInfoFile;
38
44
  if (true === config.compilerOptions.allowImportingTsExtensions) config.compilerOptions.rewriteRelativeImportExtensions = true;
39
45
  config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files);
40
46
  delete config.include;
47
+ delete config.references;
41
48
  delete config.compilerOptions.baseUrl;
42
49
  if ([
43
50
  'node',
@@ -104,6 +111,20 @@ const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
104
111
  resolve(result);
105
112
  });
106
113
  });
114
+ const getTsgoBinEntry = (pkg)=>{
115
+ if ('string' == typeof pkg.bin) return pkg.bin;
116
+ return pkg.bin?.tsgo;
117
+ };
118
+ const resolveTsgoBinPath = (pkgPath)=>{
119
+ const pkgDir = path.dirname(pkgPath);
120
+ const pkg = require(pkgPath);
121
+ const declaredBinEntry = getTsgoBinEntry(pkg);
122
+ const candidates = [
123
+ declaredBinEntry ? path.resolve(pkgDir, declaredBinEntry) : void 0,
124
+ path.join(pkgDir, 'bin/tsgo.js')
125
+ ].filter((candidate)=>Boolean(candidate));
126
+ return candidates.find((candidate)=>fs.existsSync(candidate)) ?? candidates[0];
127
+ };
107
128
  const getTsgoBinPath = (appDirectory, resolvePaths = [
108
129
  appDirectory,
109
130
  __rspack_import_meta_dirname__
@@ -112,7 +133,7 @@ const getTsgoBinPath = (appDirectory, resolvePaths = [
112
133
  const pkgPath = require.resolve("@typescript/native-preview/package.json", {
113
134
  paths: resolvePaths
114
135
  });
115
- return path.join(path.dirname(pkgPath), 'bin/tsgo.js');
136
+ return resolveTsgoBinPath(pkgPath);
116
137
  } catch {
117
138
  throw new Error('tsgo could not be found! Please install "@typescript/native-preview" in your project to compile BFF/server code.');
118
139
  }
@@ -1,4 +1,4 @@
1
- export type SpecifierRewrite = (specifier: string) => string | undefined;
1
+ type SpecifierRewrite = (specifier: string) => string | undefined;
2
2
  /**
3
3
  * Rewrite the import/export/require specifiers of emitted JavaScript.
4
4
  *
@@ -10,3 +10,4 @@ export declare const rewriteImportSpecifiers: (content: string, rewrite: Specifi
10
10
  content: string;
11
11
  changed: boolean;
12
12
  };
13
+ export {};
@@ -3,6 +3,11 @@ type TsgoConfig = {
3
3
  compilerOptions?: {
4
4
  allowImportingTsExtensions?: boolean;
5
5
  baseUrl?: unknown;
6
+ composite?: boolean;
7
+ declaration?: boolean;
8
+ declarationMap?: boolean;
9
+ emitDeclarationOnly?: boolean;
10
+ incremental?: boolean;
6
11
  module?: string;
7
12
  moduleResolution?: string;
8
13
  noEmit?: boolean;
@@ -10,10 +15,14 @@ type TsgoConfig = {
10
15
  outDir?: string;
11
16
  rootDir?: string;
12
17
  rewriteRelativeImportExtensions?: boolean;
18
+ tsBuildInfoFile?: string;
13
19
  verbatimModuleSyntax?: boolean;
14
20
  };
15
21
  files?: string[];
16
22
  include?: string[];
23
+ references?: Array<{
24
+ path: string;
25
+ }>;
17
26
  };
18
27
  export declare const createResolvedTsgoConfig: (appDirectory: string, tsconfigPath: string, distDir: string, sourceDirs: string[], moduleType: 'module' | 'commonjs' | undefined, tsgoBinPath: string) => Promise<{
19
28
  config: TsgoConfig;
package/package.json CHANGED
@@ -17,13 +17,12 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.5.0-ultramodern.5",
20
+ "version": "3.5.0-ultramodern.75",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
24
24
  ".": {
25
25
  "types": "./dist/types/index.d.ts",
26
- "modern:source": "./src/index.ts",
27
26
  "node": {
28
27
  "import": "./dist/esm-node/index.mjs",
29
28
  "require": "./dist/cjs/index.js"
@@ -39,15 +38,15 @@
39
38
  }
40
39
  },
41
40
  "dependencies": {
42
- "@swc/helpers": "^0.5.23",
43
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.5"
41
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.75",
42
+ "@swc/helpers": "^0.5.23"
44
43
  },
45
44
  "devDependencies": {
46
- "@rslib/core": "0.23.1",
47
- "@types/node": "^26.0.1",
48
- "@typescript/native-preview": "7.0.0-dev.20260628.1",
49
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.5",
50
- "@scripts/rstest-config": "2.66.0"
45
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.75",
46
+ "@rslib/core": "0.23.2",
47
+ "@scripts/rstest-config": "2.66.0",
48
+ "@types/node": "^26.1.1",
49
+ "@typescript/native-preview": "7.0.0-dev.20260707.2"
51
50
  },
52
51
  "peerDependencies": {
53
52
  "@typescript/native-preview": ">=7.0.0-dev.20260628.1"
@@ -59,7 +58,6 @@
59
58
  },
60
59
  "sideEffects": false,
61
60
  "publishConfig": {
62
- "registry": "https://registry.npmjs.org/",
63
61
  "access": "public"
64
62
  },
65
63
  "scripts": {