@esbuild-kit/cjs-loader 2.0.1 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +1 -0
- package/dist/index.js +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
@@ -8,6 +8,7 @@ Node.js `require()` hook to instantaneously transform ESM & TypeScript to Common
|
|
8
8
|
- Cached for performance boost
|
9
9
|
- Supports Node.js v12.16.2+
|
10
10
|
- Handles `node:` import prefixes
|
11
|
+
- Resolves `tsconfig.json` [`paths`](https://www.typescriptlang.org/tsconfig#paths)
|
11
12
|
|
12
13
|
> **Tip:**
|
13
14
|
>
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var y=require("path"),g=require("fs"),b=require("module"),r=require("@esbuild-kit/core-utils"),d=require("get-tsconfig");function i(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var p=i(y),M=i(g),f=i(b);const S=/^\.{0,2}\//,j=/\.[cm]?tsx?$/,F=`${p.default.sep}node_modules${p.default.sep}`,l=d.getTsconfig(),x=l==null?void 0:l.config,m=l&&d.createPathsMatcher(l),h=r.installSourceMapSupport(),n=process.versions.node.split(".").map(Number),P=n[0]>=13&&n[1]>=2||n[0]>=12&&n[1]>=20&&n[0]<13&&n[1]<0;function v(e,t){process.send&&process.send({type:"dependency",path:t});let s=M.default.readFileSync(t,"utf8");if(t.endsWith(".cjs")&&P){const o=r.transformDynamicImport(s);o&&(s=r.applySourceMap(o,t,h))}else{const o=r.transformSync(s,t,{tsconfigRaw:x});s=r.applySourceMap(o,t,h)}e._compile(s,t)}const _=f.default._extensions;[".js",".ts",".tsx",".jsx"].forEach(e=>{_[e]=v}),Object.defineProperty(_,".mjs",{value:v,enumerable:!1});const u=f.default._resolveFilename;f.default._resolveFilename=function(e,t,s,o){if(e.startsWith("node:")&&(e=e.slice(5)),m&&!S.test(e)&&!(t!=null&&t.filename.includes(F))){const c=m(e);for(const a of c)try{return u.call(this,a,t,s,o)}catch{}}if(t&&j.test(t.filename)){const c=r.resolveTsPath(e);if(c)try{return u.call(this,c,t,s,o)}catch(a){if(a.code!=="MODULE_NOT_FOUND")throw a}}return u.call(this,e,t,s,o)};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@esbuild-kit/cjs-loader",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.1",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -32,8 +32,8 @@
|
|
32
32
|
"test": "node --require ./dist/index.js tests/index.ts"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@esbuild-kit/core-utils": "^
|
36
|
-
"get-tsconfig": "^
|
35
|
+
"@esbuild-kit/core-utils": "^2.0.0",
|
36
|
+
"get-tsconfig": "^4.0.5"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"@pvtnbr/eslint-config": "^0.22.0",
|
@@ -45,7 +45,8 @@
|
|
45
45
|
"manten": "^0.1.0",
|
46
46
|
"pkgroll": "^1.3.0",
|
47
47
|
"semver": "^7.3.7",
|
48
|
-
"
|
48
|
+
"source-map-support": "^0.5.21",
|
49
|
+
"typescript": "^4.7.4"
|
49
50
|
},
|
50
51
|
"eslintConfig": {
|
51
52
|
"extends": "@pvtnbr",
|
@@ -58,6 +59,7 @@
|
|
58
59
|
"error",
|
59
60
|
{
|
60
61
|
"allow": [
|
62
|
+
"test",
|
61
63
|
"describe"
|
62
64
|
]
|
63
65
|
}
|