@bleedingdev/modern-js-server-utils 3.8.3-ultramodern.6 → 3.9.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.
@@ -45,9 +45,10 @@ const validateAbsolutePaths = (filenames, messageFunc)=>{
45
45
  filenames.forEach((filename)=>validateAbsolutePath(filename, messageFunc(filename)));
46
46
  };
47
47
  const compile = async (appDirectory, modernConfig, compileOptions)=>{
48
- const { sourceDirs, distDir, tsconfigPath } = compileOptions;
48
+ const { sourceDirs, distDir, excludeFiles = [], tsconfigPath } = compileOptions;
49
49
  validateAbsolutePaths(sourceDirs, (dir)=>`source dir ${dir} is not an absolute path.`);
50
50
  validateAbsolutePath(distDir, `dist dir ${distDir} is not an absolute path.`);
51
+ validateAbsolutePaths(excludeFiles, (file)=>`excluded file ${file} is not an absolute path.`);
51
52
  const { compileByTs } = await import("../compilers/typescript/index.js");
52
53
  await compileByTs(appDirectory, modernConfig, compileOptions);
53
54
  };
@@ -58,7 +58,7 @@ const copyFiles = async (from, to, appDirectory)=>{
58
58
  }
59
59
  };
60
60
  let resolvedConfigCount = 0;
61
- const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sourceDirs, moduleType, tsgoBinPath)=>{
61
+ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sourceDirs, moduleType, tsgoBinPath, excludeFiles = [])=>{
62
62
  const tsconfigDir = external_path_default().dirname(tsconfigPath);
63
63
  const output = await runTsgo(tsgoBinPath, [
64
64
  '--showConfig',
@@ -79,7 +79,7 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
79
79
  if (void 0 === config.compilerOptions.jsx || 'preserve' === config.compilerOptions.jsx) config.compilerOptions.jsx = 'react-jsx';
80
80
  delete config.compilerOptions.tsBuildInfoFile;
81
81
  if (true === config.compilerOptions.allowImportingTsExtensions) config.compilerOptions.rewriteRelativeImportExtensions = true;
82
- config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files);
82
+ config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files, excludeFiles);
83
83
  delete config.include;
84
84
  delete config.references;
85
85
  delete config.compilerOptions.baseUrl;
@@ -108,15 +108,15 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
108
108
  resolvedConfigPath
109
109
  };
110
110
  };
111
- const filterSourceFiles = (tsconfigDir, sourceDirs, files = [])=>{
111
+ const filterSourceFiles = (tsconfigDir, sourceDirs, files = [], excludeFiles = [])=>{
112
112
  const sourcePosixPaths = sourceDirs.map((sourceDir)=>sourceDir.split(external_path_default().sep).join(external_path_default().posix.sep));
113
+ const excludedPaths = new Set(excludeFiles.map((file)=>external_path_default().normalize(file).split(external_path_default().sep).join(external_path_default().posix.sep)));
113
114
  return files.filter((fileName)=>{
114
115
  const absoluteFileName = external_path_default().resolve(tsconfigDir, fileName).split(external_path_default().sep).join(external_path_default().posix.sep);
115
- if (isAppRouterGeneratedDeclaration(absoluteFileName)) return false;
116
+ if (excludedPaths.has(absoluteFileName)) return false;
116
117
  return fileName.endsWith('.d.ts') || sourcePosixPaths.some((sourceDir)=>absoluteFileName.includes(sourceDir));
117
118
  });
118
119
  };
119
- const isAppRouterGeneratedDeclaration = (absoluteFileName)=>/\/src\/modern-tanstack\/.*\.gen\.d\.ts$/u.test(absoluteFileName);
120
120
  const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
121
121
  const child = (0, external_child_process_namespaceObject.spawn)(process.execPath, [
122
122
  tsgoBinPath,
@@ -269,7 +269,7 @@ const compileByTs = async (appDirectory, config, compileOptions)=>{
269
269
  });
270
270
  const { paths = {}, absoluteBaseUrl = './' } = aliasOption;
271
271
  const tsgoBinPath = getTsgoBinPath(appDirectory);
272
- const { config: tsgoConfig, resolvedConfigPath } = await createResolvedTsgoConfig(appDirectory, tsconfigPath, distDir, sourceDirs, compileOptions.moduleType, tsgoBinPath);
272
+ const { config: tsgoConfig, resolvedConfigPath } = await createResolvedTsgoConfig(appDirectory, tsconfigPath, distDir, sourceDirs, compileOptions.moduleType, tsgoBinPath, compileOptions.excludeFiles);
273
273
  let result;
274
274
  try {
275
275
  result = await runTsgo(tsgoBinPath, [
@@ -12,9 +12,10 @@ const validateAbsolutePaths = (filenames, messageFunc)=>{
12
12
  filenames.forEach((filename)=>validateAbsolutePath(filename, messageFunc(filename)));
13
13
  };
14
14
  const compile = async (appDirectory, modernConfig, compileOptions)=>{
15
- const { sourceDirs, distDir, tsconfigPath } = compileOptions;
15
+ const { sourceDirs, distDir, excludeFiles = [], tsconfigPath } = compileOptions;
16
16
  validateAbsolutePaths(sourceDirs, (dir)=>`source dir ${dir} is not an absolute path.`);
17
17
  validateAbsolutePath(distDir, `dist dir ${distDir} is not an absolute path.`);
18
+ validateAbsolutePaths(excludeFiles, (file)=>`excluded file ${file} is not an absolute path.`);
18
19
  const { compileByTs } = await import("../compilers/typescript/index.mjs");
19
20
  await compileByTs(appDirectory, modernConfig, compileOptions);
20
21
  };
@@ -13,7 +13,7 @@ const copyFiles = async (from, to, appDirectory)=>{
13
13
  }
14
14
  };
15
15
  let resolvedConfigCount = 0;
16
- const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sourceDirs, moduleType, tsgoBinPath)=>{
16
+ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sourceDirs, moduleType, tsgoBinPath, excludeFiles = [])=>{
17
17
  const tsconfigDir = path.dirname(tsconfigPath);
18
18
  const output = await runTsgo(tsgoBinPath, [
19
19
  '--showConfig',
@@ -34,7 +34,7 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
34
34
  if (void 0 === config.compilerOptions.jsx || 'preserve' === config.compilerOptions.jsx) config.compilerOptions.jsx = 'react-jsx';
35
35
  delete config.compilerOptions.tsBuildInfoFile;
36
36
  if (true === config.compilerOptions.allowImportingTsExtensions) config.compilerOptions.rewriteRelativeImportExtensions = true;
37
- config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files);
37
+ config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files, excludeFiles);
38
38
  delete config.include;
39
39
  delete config.references;
40
40
  delete config.compilerOptions.baseUrl;
@@ -63,15 +63,15 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
63
63
  resolvedConfigPath
64
64
  };
65
65
  };
66
- const filterSourceFiles = (tsconfigDir, sourceDirs, files = [])=>{
66
+ const filterSourceFiles = (tsconfigDir, sourceDirs, files = [], excludeFiles = [])=>{
67
67
  const sourcePosixPaths = sourceDirs.map((sourceDir)=>sourceDir.split(path.sep).join(path.posix.sep));
68
+ const excludedPaths = new Set(excludeFiles.map((file)=>path.normalize(file).split(path.sep).join(path.posix.sep)));
68
69
  return files.filter((fileName)=>{
69
70
  const absoluteFileName = path.resolve(tsconfigDir, fileName).split(path.sep).join(path.posix.sep);
70
- if (isAppRouterGeneratedDeclaration(absoluteFileName)) return false;
71
+ if (excludedPaths.has(absoluteFileName)) return false;
71
72
  return fileName.endsWith('.d.ts') || sourcePosixPaths.some((sourceDir)=>absoluteFileName.includes(sourceDir));
72
73
  });
73
74
  };
74
- const isAppRouterGeneratedDeclaration = (absoluteFileName)=>/\/src\/modern-tanstack\/.*\.gen\.d\.ts$/u.test(absoluteFileName);
75
75
  const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
76
76
  const child = spawn(process.execPath, [
77
77
  tsgoBinPath,
@@ -224,7 +224,7 @@ const compileByTs = async (appDirectory, config, compileOptions)=>{
224
224
  });
225
225
  const { paths = {}, absoluteBaseUrl = './' } = aliasOption;
226
226
  const tsgoBinPath = getTsgoBinPath(appDirectory);
227
- const { config: tsgoConfig, resolvedConfigPath } = await createResolvedTsgoConfig(appDirectory, tsconfigPath, distDir, sourceDirs, compileOptions.moduleType, tsgoBinPath);
227
+ const { config: tsgoConfig, resolvedConfigPath } = await createResolvedTsgoConfig(appDirectory, tsconfigPath, distDir, sourceDirs, compileOptions.moduleType, tsgoBinPath, compileOptions.excludeFiles);
228
228
  let result;
229
229
  try {
230
230
  result = await runTsgo(tsgoBinPath, [
@@ -13,9 +13,10 @@ const validateAbsolutePaths = (filenames, messageFunc)=>{
13
13
  filenames.forEach((filename)=>validateAbsolutePath(filename, messageFunc(filename)));
14
14
  };
15
15
  const compile = async (appDirectory, modernConfig, compileOptions)=>{
16
- const { sourceDirs, distDir, tsconfigPath } = compileOptions;
16
+ const { sourceDirs, distDir, excludeFiles = [], tsconfigPath } = compileOptions;
17
17
  validateAbsolutePaths(sourceDirs, (dir)=>`source dir ${dir} is not an absolute path.`);
18
18
  validateAbsolutePath(distDir, `dist dir ${distDir} is not an absolute path.`);
19
+ validateAbsolutePaths(excludeFiles, (file)=>`excluded file ${file} is not an absolute path.`);
19
20
  const { compileByTs } = await import("../compilers/typescript/index.mjs");
20
21
  await compileByTs(appDirectory, modernConfig, compileOptions);
21
22
  };
@@ -18,7 +18,7 @@ const copyFiles = async (from, to, appDirectory)=>{
18
18
  }
19
19
  };
20
20
  let resolvedConfigCount = 0;
21
- const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sourceDirs, moduleType, tsgoBinPath)=>{
21
+ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sourceDirs, moduleType, tsgoBinPath, excludeFiles = [])=>{
22
22
  const tsconfigDir = path.dirname(tsconfigPath);
23
23
  const output = await runTsgo(tsgoBinPath, [
24
24
  '--showConfig',
@@ -39,7 +39,7 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
39
39
  if (void 0 === config.compilerOptions.jsx || 'preserve' === config.compilerOptions.jsx) config.compilerOptions.jsx = 'react-jsx';
40
40
  delete config.compilerOptions.tsBuildInfoFile;
41
41
  if (true === config.compilerOptions.allowImportingTsExtensions) config.compilerOptions.rewriteRelativeImportExtensions = true;
42
- config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files);
42
+ config.files = filterSourceFiles(tsconfigDir, sourceDirs, config.files, excludeFiles);
43
43
  delete config.include;
44
44
  delete config.references;
45
45
  delete config.compilerOptions.baseUrl;
@@ -68,15 +68,15 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
68
68
  resolvedConfigPath
69
69
  };
70
70
  };
71
- const filterSourceFiles = (tsconfigDir, sourceDirs, files = [])=>{
71
+ const filterSourceFiles = (tsconfigDir, sourceDirs, files = [], excludeFiles = [])=>{
72
72
  const sourcePosixPaths = sourceDirs.map((sourceDir)=>sourceDir.split(path.sep).join(path.posix.sep));
73
+ const excludedPaths = new Set(excludeFiles.map((file)=>path.normalize(file).split(path.sep).join(path.posix.sep)));
73
74
  return files.filter((fileName)=>{
74
75
  const absoluteFileName = path.resolve(tsconfigDir, fileName).split(path.sep).join(path.posix.sep);
75
- if (isAppRouterGeneratedDeclaration(absoluteFileName)) return false;
76
+ if (excludedPaths.has(absoluteFileName)) return false;
76
77
  return fileName.endsWith('.d.ts') || sourcePosixPaths.some((sourceDir)=>absoluteFileName.includes(sourceDir));
77
78
  });
78
79
  };
79
- const isAppRouterGeneratedDeclaration = (absoluteFileName)=>/\/src\/modern-tanstack\/.*\.gen\.d\.ts$/u.test(absoluteFileName);
80
80
  const runTsgo = (tsgoBinPath, args, options)=>new Promise((resolve, reject)=>{
81
81
  const child = spawn(process.execPath, [
82
82
  tsgoBinPath,
@@ -229,7 +229,7 @@ const compileByTs = async (appDirectory, config, compileOptions)=>{
229
229
  });
230
230
  const { paths = {}, absoluteBaseUrl = './' } = aliasOption;
231
231
  const tsgoBinPath = getTsgoBinPath(appDirectory);
232
- const { config: tsgoConfig, resolvedConfigPath } = await createResolvedTsgoConfig(appDirectory, tsconfigPath, distDir, sourceDirs, compileOptions.moduleType, tsgoBinPath);
232
+ const { config: tsgoConfig, resolvedConfigPath } = await createResolvedTsgoConfig(appDirectory, tsconfigPath, distDir, sourceDirs, compileOptions.moduleType, tsgoBinPath, compileOptions.excludeFiles);
233
233
  let result;
234
234
  try {
235
235
  result = await runTsgo(tsgoBinPath, [
@@ -13,6 +13,8 @@ export interface IConfig {
13
13
  export interface CompileOptions {
14
14
  sourceDirs: string[];
15
15
  distDir: string;
16
+ /** Absolute files excluded as roots; imported dependencies remain checked. */
17
+ excludeFiles?: string[];
16
18
  tsconfigPath?: string;
17
19
  moduleType?: 'module' | 'commonjs';
18
20
  throwErrorInsteadOfExit?: boolean;
@@ -1,4 +1,4 @@
1
- import type { CompileFunc } from '../../common';
1
+ import type { CompileFunc } from '../../common/index.js';
2
2
  type TsgoConfig = {
3
3
  compilerOptions?: {
4
4
  allowImportingTsExtensions?: boolean;
@@ -25,7 +25,7 @@ type TsgoConfig = {
25
25
  path: string;
26
26
  }>;
27
27
  };
28
- export declare const createResolvedTsgoConfig: (appDirectory: string, tsconfigPath: string, distDir: string, sourceDirs: string[], moduleType: 'module' | 'commonjs' | undefined, tsgoBinPath: string) => Promise<{
28
+ export declare const createResolvedTsgoConfig: (appDirectory: string, tsconfigPath: string, distDir: string, sourceDirs: string[], moduleType: 'module' | 'commonjs' | undefined, tsgoBinPath: string, excludeFiles?: string[]) => Promise<{
29
29
  config: TsgoConfig;
30
30
  resolvedConfigPath: string;
31
31
  }>;
@@ -1 +1 @@
1
- export { compile } from './common';
1
+ export { compile } from './common/index.js';
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.8.3-ultramodern.6",
20
+ "version": "3.9.0-ultramodern.10",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -38,15 +38,15 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.3-ultramodern.6",
42
- "@swc/core": "1.15.43",
41
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.10",
42
+ "@swc/core": "1.16.2",
43
43
  "@swc/helpers": "^0.5.23"
44
44
  },
45
45
  "devDependencies": {
46
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.3-ultramodern.6",
47
- "@rslib/core": "0.23.2",
46
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.9.0-ultramodern.10",
47
+ "@rslib/core": "1.0.0",
48
48
  "@scripts/rstest-config": "2.66.0",
49
- "@types/node": "^26.2.0",
49
+ "@types/node": "^26.4.1",
50
50
  "@typescript/native-preview": "7.0.0-dev.20260707.2"
51
51
  },
52
52
  "peerDependencies": {