@bleedingdev/modern-js-server-utils 3.8.1-ultramodern.4 → 3.8.2-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.
@@ -77,7 +77,6 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
77
77
  config.compilerOptions.rootDir = appDirectory;
78
78
  config.compilerOptions.outDir = distDir;
79
79
  config.compilerOptions.composite = false;
80
- config.compilerOptions.declaration = false;
81
80
  config.compilerOptions.declarationMap = false;
82
81
  config.compilerOptions.emitDeclarationOnly = false;
83
82
  config.compilerOptions.incremental = false;
@@ -195,13 +194,30 @@ const OUTPUT_SOURCE_EXTENSIONS = {
195
194
  '.cjs': [
196
195
  '.cts',
197
196
  '.cjs'
197
+ ],
198
+ '.d.ts': [
199
+ '.ts',
200
+ '.tsx',
201
+ '.js',
202
+ '.jsx'
203
+ ],
204
+ '.d.mts': [
205
+ '.mts',
206
+ '.mjs'
207
+ ],
208
+ '.d.cts': [
209
+ '.cts',
210
+ '.cjs'
198
211
  ]
199
212
  };
200
213
  const getSourceFileForOutput = (appDirectory, distDir, outputFile)=>{
201
214
  const relativeOutput = external_path_default().relative(distDir, outputFile);
202
215
  const parsed = external_path_default().parse(relativeOutput);
203
- const sourceBase = external_path_default().join(appDirectory, parsed.dir, parsed.name);
204
- const extensions = OUTPUT_SOURCE_EXTENSIONS[parsed.ext] ?? OUTPUT_SOURCE_EXTENSIONS['.js'];
216
+ const isDeclaration = parsed.name.endsWith('.d');
217
+ const outputExtension = isDeclaration ? `.d${parsed.ext}` : parsed.ext;
218
+ const sourceName = isDeclaration ? parsed.name.slice(0, -2) : parsed.name;
219
+ const sourceBase = external_path_default().join(appDirectory, parsed.dir, sourceName);
220
+ const extensions = OUTPUT_SOURCE_EXTENSIONS[outputExtension] ?? OUTPUT_SOURCE_EXTENSIONS['.js'];
205
221
  for (const extension of extensions){
206
222
  const candidate = `${sourceBase}${extension}`;
207
223
  if (utils_namespaceObject.fs.existsSync(candidate)) return candidate;
@@ -233,7 +249,7 @@ const collectOutputFiles = async (dir)=>{
233
249
  const files = await Promise.all(entries.map(async (entry)=>{
234
250
  const fullPath = external_path_default().join(dir, entry.name);
235
251
  if (entry.isDirectory()) return collectOutputFiles(fullPath);
236
- return /\.(?:c|m)?js$/.test(entry.name) ? [
252
+ return /\.(?:c|m)?js$|\.d\.(?:c|m)?ts$/.test(entry.name) ? [
237
253
  fullPath
238
254
  ] : [];
239
255
  }));
@@ -32,7 +32,6 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
32
32
  config.compilerOptions.rootDir = appDirectory;
33
33
  config.compilerOptions.outDir = distDir;
34
34
  config.compilerOptions.composite = false;
35
- config.compilerOptions.declaration = false;
36
35
  config.compilerOptions.declarationMap = false;
37
36
  config.compilerOptions.emitDeclarationOnly = false;
38
37
  config.compilerOptions.incremental = false;
@@ -150,13 +149,30 @@ const OUTPUT_SOURCE_EXTENSIONS = {
150
149
  '.cjs': [
151
150
  '.cts',
152
151
  '.cjs'
152
+ ],
153
+ '.d.ts': [
154
+ '.ts',
155
+ '.tsx',
156
+ '.js',
157
+ '.jsx'
158
+ ],
159
+ '.d.mts': [
160
+ '.mts',
161
+ '.mjs'
162
+ ],
163
+ '.d.cts': [
164
+ '.cts',
165
+ '.cjs'
153
166
  ]
154
167
  };
155
168
  const getSourceFileForOutput = (appDirectory, distDir, outputFile)=>{
156
169
  const relativeOutput = path.relative(distDir, outputFile);
157
170
  const parsed = path.parse(relativeOutput);
158
- const sourceBase = path.join(appDirectory, parsed.dir, parsed.name);
159
- const extensions = OUTPUT_SOURCE_EXTENSIONS[parsed.ext] ?? OUTPUT_SOURCE_EXTENSIONS['.js'];
171
+ const isDeclaration = parsed.name.endsWith('.d');
172
+ const outputExtension = isDeclaration ? `.d${parsed.ext}` : parsed.ext;
173
+ const sourceName = isDeclaration ? parsed.name.slice(0, -2) : parsed.name;
174
+ const sourceBase = path.join(appDirectory, parsed.dir, sourceName);
175
+ const extensions = OUTPUT_SOURCE_EXTENSIONS[outputExtension] ?? OUTPUT_SOURCE_EXTENSIONS['.js'];
160
176
  for (const extension of extensions){
161
177
  const candidate = `${sourceBase}${extension}`;
162
178
  if (fs.existsSync(candidate)) return candidate;
@@ -188,7 +204,7 @@ const collectOutputFiles = async (dir)=>{
188
204
  const files = await Promise.all(entries.map(async (entry)=>{
189
205
  const fullPath = path.join(dir, entry.name);
190
206
  if (entry.isDirectory()) return collectOutputFiles(fullPath);
191
- return /\.(?:c|m)?js$/.test(entry.name) ? [
207
+ return /\.(?:c|m)?js$|\.d\.(?:c|m)?ts$/.test(entry.name) ? [
192
208
  fullPath
193
209
  ] : [];
194
210
  }));
@@ -37,7 +37,6 @@ const createResolvedTsgoConfig = async (appDirectory, tsconfigPath, distDir, sou
37
37
  config.compilerOptions.rootDir = appDirectory;
38
38
  config.compilerOptions.outDir = distDir;
39
39
  config.compilerOptions.composite = false;
40
- config.compilerOptions.declaration = false;
41
40
  config.compilerOptions.declarationMap = false;
42
41
  config.compilerOptions.emitDeclarationOnly = false;
43
42
  config.compilerOptions.incremental = false;
@@ -155,13 +154,30 @@ const OUTPUT_SOURCE_EXTENSIONS = {
155
154
  '.cjs': [
156
155
  '.cts',
157
156
  '.cjs'
157
+ ],
158
+ '.d.ts': [
159
+ '.ts',
160
+ '.tsx',
161
+ '.js',
162
+ '.jsx'
163
+ ],
164
+ '.d.mts': [
165
+ '.mts',
166
+ '.mjs'
167
+ ],
168
+ '.d.cts': [
169
+ '.cts',
170
+ '.cjs'
158
171
  ]
159
172
  };
160
173
  const getSourceFileForOutput = (appDirectory, distDir, outputFile)=>{
161
174
  const relativeOutput = path.relative(distDir, outputFile);
162
175
  const parsed = path.parse(relativeOutput);
163
- const sourceBase = path.join(appDirectory, parsed.dir, parsed.name);
164
- const extensions = OUTPUT_SOURCE_EXTENSIONS[parsed.ext] ?? OUTPUT_SOURCE_EXTENSIONS['.js'];
176
+ const isDeclaration = parsed.name.endsWith('.d');
177
+ const outputExtension = isDeclaration ? `.d${parsed.ext}` : parsed.ext;
178
+ const sourceName = isDeclaration ? parsed.name.slice(0, -2) : parsed.name;
179
+ const sourceBase = path.join(appDirectory, parsed.dir, sourceName);
180
+ const extensions = OUTPUT_SOURCE_EXTENSIONS[outputExtension] ?? OUTPUT_SOURCE_EXTENSIONS['.js'];
165
181
  for (const extension of extensions){
166
182
  const candidate = `${sourceBase}${extension}`;
167
183
  if (fs.existsSync(candidate)) return candidate;
@@ -193,7 +209,7 @@ const collectOutputFiles = async (dir)=>{
193
209
  const files = await Promise.all(entries.map(async (entry)=>{
194
210
  const fullPath = path.join(dir, entry.name);
195
211
  if (entry.isDirectory()) return collectOutputFiles(fullPath);
196
- return /\.(?:c|m)?js$/.test(entry.name) ? [
212
+ return /\.(?:c|m)?js$|\.d\.(?:c|m)?ts$/.test(entry.name) ? [
197
213
  fullPath
198
214
  ] : [];
199
215
  }));
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.8.1-ultramodern.4",
20
+ "version": "3.8.2-ultramodern.10",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -38,11 +38,11 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.1-ultramodern.4",
41
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.2-ultramodern.10",
42
42
  "@swc/helpers": "^0.5.23"
43
43
  },
44
44
  "devDependencies": {
45
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.1-ultramodern.4",
45
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.8.2-ultramodern.10",
46
46
  "@rslib/core": "0.23.2",
47
47
  "@scripts/rstest-config": "2.66.0",
48
48
  "@types/node": "^26.2.0",