@poppinss/ts-exec 1.1.0 → 1.1.2

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.
@@ -123,7 +123,6 @@ async function getPackageJson(searchPath) {
123
123
  var swcConfig;
124
124
  var tsConfig;
125
125
  var subPathImports;
126
- var UNALLOWED_FILE_EXTENSIONS = [".tsx", ".ts", ".mts", ".cts"];
127
126
  function isLocalPath(specifier) {
128
127
  return specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/") || specifier.startsWith("file:");
129
128
  }
@@ -164,13 +163,12 @@ var resolve = async (specifier, context, nextResolve) => {
164
163
  specifier = resolvedPaths[0];
165
164
  }
166
165
  }
167
- const allowArbitraryExtensions = !!tsConfig?.compilerOptions?.allowArbitraryExtensions;
168
- if (!allowArbitraryExtensions) {
169
- if (isLocalPath(specifier)) {
166
+ debug_default("resolving file with specifier %s", specifier);
167
+ try {
168
+ return await nextResolve(specifier, context);
169
+ } catch (error) {
170
+ if (!tsConfig?.compilerOptions?.allowArbitraryExtensions && error.code === "ERR_MODULE_NOT_FOUND" && isLocalPath(specifier)) {
170
171
  const fileExtension = extname(specifier);
171
- if (UNALLOWED_FILE_EXTENSIONS.includes(fileExtension) && context.parentURL) {
172
- throw new Error(`Unknown file extension "${fileExtension}"`);
173
- }
174
172
  if (fileExtension === ".js") {
175
173
  specifier = specifier.replace(".js", ".ts");
176
174
  } else if (fileExtension === ".mjs") {
@@ -180,10 +178,11 @@ var resolve = async (specifier, context, nextResolve) => {
180
178
  } else if (fileExtension === ".jsx") {
181
179
  specifier = specifier.replace(".jsx", ".tsx");
182
180
  }
181
+ debug_default("retrying to resolve file with specifier %s", specifier);
182
+ return nextResolve(specifier, context);
183
183
  }
184
+ throw error;
184
185
  }
185
- debug_default("resolving file with specifier %s", specifier);
186
- return nextResolve(specifier, context);
187
186
  };
188
187
  var load = async function load2(url, context, nextLoad) {
189
188
  const { format } = context;
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@poppinss/ts-exec",
3
3
  "description": "",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "engines": {
6
- "node": ">=20.6.0"
6
+ "node": ">=24.0.0"
7
7
  },
8
8
  "type": "module",
9
9
  "files": [
@@ -120,8 +120,5 @@
120
120
  "tests/**"
121
121
  ]
122
122
  },
123
- "prettier": "@adonisjs/prettier-config",
124
- "volta": {
125
- "node": "24.0.0"
126
- }
123
+ "prettier": "@adonisjs/prettier-config"
127
124
  }