@poppinss/ts-exec 1.1.1 → 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.
- package/build/src/loader.js +1 -16
- package/package.json +3 -7
package/build/src/loader.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// src/loader.ts
|
|
2
2
|
import { extname } from "node:path";
|
|
3
3
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
4
|
-
import { createError } from "@poppinss/exception";
|
|
5
4
|
import { resolveImports } from "resolve-pkg-maps";
|
|
6
5
|
|
|
7
6
|
// src/debug.ts
|
|
@@ -124,11 +123,6 @@ async function getPackageJson(searchPath) {
|
|
|
124
123
|
var swcConfig;
|
|
125
124
|
var tsConfig;
|
|
126
125
|
var subPathImports;
|
|
127
|
-
var ERR_UNKNOWN_FILE_EXTENSION = createError(
|
|
128
|
-
'Unknown file extension "%s"',
|
|
129
|
-
"ERR_UNKNOWN_FILE_EXTENSION"
|
|
130
|
-
);
|
|
131
|
-
var UNALLOWED_FILE_EXTENSIONS = [".tsx", ".ts", ".mts", ".cts"];
|
|
132
126
|
function isLocalPath(specifier) {
|
|
133
127
|
return specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/") || specifier.startsWith("file:");
|
|
134
128
|
}
|
|
@@ -169,20 +163,11 @@ var resolve = async (specifier, context, nextResolve) => {
|
|
|
169
163
|
specifier = resolvedPaths[0];
|
|
170
164
|
}
|
|
171
165
|
}
|
|
172
|
-
const allowArbitraryExtensions = !!tsConfig?.compilerOptions?.allowArbitraryExtensions;
|
|
173
|
-
if (!allowArbitraryExtensions) {
|
|
174
|
-
if (isLocalPath(specifier)) {
|
|
175
|
-
const fileExtension = extname(specifier);
|
|
176
|
-
if (UNALLOWED_FILE_EXTENSIONS.includes(fileExtension) && context.parentURL) {
|
|
177
|
-
throw new ERR_UNKNOWN_FILE_EXTENSION([fileExtension]);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
166
|
debug_default("resolving file with specifier %s", specifier);
|
|
182
167
|
try {
|
|
183
168
|
return await nextResolve(specifier, context);
|
|
184
169
|
} catch (error) {
|
|
185
|
-
if (!allowArbitraryExtensions && error.code === "ERR_MODULE_NOT_FOUND" && isLocalPath(specifier)) {
|
|
170
|
+
if (!tsConfig?.compilerOptions?.allowArbitraryExtensions && error.code === "ERR_MODULE_NOT_FOUND" && isLocalPath(specifier)) {
|
|
186
171
|
const fileExtension = extname(specifier);
|
|
187
172
|
if (fileExtension === ".js") {
|
|
188
173
|
specifier = specifier.replace(".js", ".ts");
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poppinss/ts-exec",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.2",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=
|
|
6
|
+
"node": ">=24.0.0"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"files": [
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"typescript": "^5.7.2"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@poppinss/exception": "^1.2.1",
|
|
56
55
|
"@swc/core": "^1.11.24",
|
|
57
56
|
"get-tsconfig": "^4.10.0",
|
|
58
57
|
"resolve-pkg-maps": "^1.0.0"
|
|
@@ -121,8 +120,5 @@
|
|
|
121
120
|
"tests/**"
|
|
122
121
|
]
|
|
123
122
|
},
|
|
124
|
-
"prettier": "@adonisjs/prettier-config"
|
|
125
|
-
"volta": {
|
|
126
|
-
"node": "24.0.0"
|
|
127
|
-
}
|
|
123
|
+
"prettier": "@adonisjs/prettier-config"
|
|
128
124
|
}
|