@esbuild-kit/cjs-loader 2.2.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.js +1 -1
- package/package.json +11 -20
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) Hiroki Osame <hiroki.osame@gmail.com>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
@@ -34,6 +34,15 @@ The following properties are used from `tsconfig.json` in the working directory:
|
|
34
34
|
- `jsxFactory`
|
35
35
|
- `jsxFragmentFactory`
|
36
36
|
|
37
|
+
#### Custom `tsconfig.json` path
|
38
|
+
By default, `tsconfig.json` will be detected from the current working directory.
|
39
|
+
|
40
|
+
To set a custom path, use the `ESBK_TSCONFIG_PATH` environment variable:
|
41
|
+
|
42
|
+
```sh
|
43
|
+
ESBK_TSCONFIG_PATH=./path/to/tsconfig.custom.json node -r @esbuild/cjs-loader ./file.js
|
44
|
+
```
|
45
|
+
|
37
46
|
### Cache
|
38
47
|
Modules transformations are cached in the system cache directory ([`TMPDIR`](https://en.wikipedia.org/wiki/TMPDIR)). Transforms are cached by content hash so duplicate dependencies are not re-transformed.
|
39
48
|
|
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
"use strict";var
|
1
|
+
"use strict";var T=require("path"),g=require("fs"),S=require("module"),o=require("@esbuild-kit/core-utils"),i=require("get-tsconfig");function l(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var p=l(T),y=l(g),f=l(S);const N=/^\.{0,2}\//,P=/\.[cm]?tsx?$/,E=`${p.default.sep}node_modules${p.default.sep}`,a=process.env.ESBK_TSCONFIG_PATH?{path:process.env.ESBK_TSCONFIG_PATH,config:i.parseTsconfig(process.env.ESBK_TSCONFIG_PATH)}:i.getTsconfig(),F=a==null?void 0:a.config,m=a&&i.createPathsMatcher(a),_=o.installSourceMapSupport(),O=o.compareNodeVersion([13,2,0])>=0||o.compareNodeVersion([12,20,0])>=0&&o.compareNodeVersion([13,0,0])<0;function h(e,s){process.send&&process.send({type:"dependency",path:s});let t=y.default.readFileSync(s,"utf8");if(s.endsWith(".cjs")&&O){const r=o.transformDynamicImport(t);r&&(t=o.applySourceMap(r,s,_))}else{const r=o.transformSync(t,s,{tsconfigRaw:F});t=o.applySourceMap(r,s,_)}e._compile(t,s)}const v=f.default._extensions;[".js",".ts",".tsx",".jsx"].forEach(e=>{v[e]=h}),Object.defineProperty(v,".mjs",{value:h,enumerable:!1});const M=o.compareNodeVersion([16,0,0])>=0||o.compareNodeVersion([14,18,0])>=0,d=f.default._resolveFilename;f.default._resolveFilename=function(e,s,t,r){if(!M&&e.startsWith("node:")&&(e=e.slice(5)),m&&!N.test(e)&&!(s!=null&&s.filename.includes(E))){const c=m(e);for(const n of c)try{return d.call(this,n,s,t,r)}catch{}}if(s&&P.test(s.filename)){const c=o.resolveTsPath(e);if(c)try{return d.call(this,c,s,t,r)}catch(n){const{code:u}=n;if(u!=="MODULE_NOT_FOUND"&&u!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw n}}return d.call(this,e,s,t,r)};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@esbuild-kit/cjs-loader",
|
3
|
-
"version": "2.2
|
3
|
+
"version": "2.3.2",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -32,18 +32,18 @@
|
|
32
32
|
"test": "node --require ./dist/index.js tests/index.ts"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@esbuild-kit/core-utils": "^2.
|
36
|
-
"get-tsconfig": "^4.0
|
35
|
+
"@esbuild-kit/core-utils": "^2.1.0",
|
36
|
+
"get-tsconfig": "^4.1.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
|
-
"@pvtnbr/eslint-config": "^0.
|
40
|
-
"@types/node": "^
|
41
|
-
"@types/semver": "^7.3.
|
42
|
-
"eslint": "^8.
|
39
|
+
"@pvtnbr/eslint-config": "^0.26.2",
|
40
|
+
"@types/node": "^18.0.0",
|
41
|
+
"@types/semver": "^7.3.10",
|
42
|
+
"eslint": "^8.18.0",
|
43
43
|
"execa": "^6.1.0",
|
44
|
-
"get-node": "^
|
45
|
-
"manten": "^0.1
|
46
|
-
"pkgroll": "^1.3.
|
44
|
+
"get-node": "^13.1.0",
|
45
|
+
"manten": "^0.2.1",
|
46
|
+
"pkgroll": "^1.3.1",
|
47
47
|
"semver": "^7.3.7",
|
48
48
|
"source-map-support": "^0.5.21",
|
49
49
|
"typescript": "^4.7.4"
|
@@ -54,16 +54,7 @@
|
|
54
54
|
"tests/fixtures"
|
55
55
|
],
|
56
56
|
"rules": {
|
57
|
-
"import/no-unresolved": "off"
|
58
|
-
"@typescript-eslint/no-shadow": [
|
59
|
-
"error",
|
60
|
-
{
|
61
|
-
"allow": [
|
62
|
-
"test",
|
63
|
-
"describe"
|
64
|
-
]
|
65
|
-
}
|
66
|
-
]
|
57
|
+
"import/no-unresolved": "off"
|
67
58
|
}
|
68
59
|
}
|
69
60
|
}
|