@esbuild-kit/cjs-loader 2.1.0 → 2.3.0
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 +5 -4
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 g=require("path"),S=require("fs"),y=require("module"),n=require("@esbuild-kit/core-utils"),i=require("get-tsconfig");function f(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var p=f(g),T=f(S),u=f(y);const F=/^\.{0,2}\//,P=/\.[cm]?tsx?$/,b=`${p.default.sep}node_modules${p.default.sep}`,l=process.env.ESBK_TSCONFIG_PATH?{path:process.env.ESBK_TSCONFIG_PATH,config:i.parseTsconfig(process.env.ESBK_TSCONFIG_PATH)}:i.getTsconfig(),M=l==null?void 0:l.config,m=l&&i.createPathsMatcher(l),_=n.installSourceMapSupport(),r=process.versions.node.split(".").map(Number),O=r[0]>=13&&r[1]>=2||r[0]>=12&&r[1]>=20&&r[0]<13&&r[1]<0;function v(e,s){process.send&&process.send({type:"dependency",path:s});let t=T.default.readFileSync(s,"utf8");if(s.endsWith(".cjs")&&O){const o=n.transformDynamicImport(t);o&&(t=n.applySourceMap(o,s,_))}else{const o=n.transformSync(t,s,{tsconfigRaw:M});t=n.applySourceMap(o,s,_)}e._compile(t,s)}const h=u.default._extensions;[".js",".ts",".tsx",".jsx"].forEach(e=>{h[e]=v}),Object.defineProperty(h,".mjs",{value:v,enumerable:!1});const d=u.default._resolveFilename;u.default._resolveFilename=function(e,s,t,o){if(e.startsWith("node:")&&(e=e.slice(5)),m&&!F.test(e)&&!(s!=null&&s.filename.includes(b))){const c=m(e);for(const a of c)try{return d.call(this,a,s,t,o)}catch{}}if(s&&P.test(s.filename)){const c=n.resolveTsPath(e);if(c)try{return d.call(this,c,s,t,o)}catch(a){if(a.code!=="MODULE_NOT_FOUND")throw a}}return d.call(this,e,s,t,o)};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@esbuild-kit/cjs-loader",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.3.0",
|
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": "^4.
|
35
|
+
"@esbuild-kit/core-utils": "^2.0.0",
|
36
|
+
"get-tsconfig": "^4.1.0"
|
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",
|