@esbuild-kit/cjs-loader 2.4.1 → 2.4.2

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -31,8 +31,14 @@ node -r @esbuild-kit/cjs-loader ./file.js
31
31
 
32
32
  ### TypeScript configuration
33
33
  The following properties are used from `tsconfig.json` in the working directory:
34
- - `jsxFactory`
35
- - `jsxFragmentFactory`
34
+ - [`strict`](https://www.typescriptlang.org/tsconfig#strict): Whether to transform to strict mode
35
+ - [`jsx`](https://esbuild.github.io/api/#jsx): Whether to transform JSX
36
+ > **Warning:** When set to `preserve`, the JSX syntax will remain untransformed. To prevent Node.js from throwing a syntax error, chain another Node.js loader that can transform JSX to JS.
37
+ - [`jsxFactory`](https://esbuild.github.io/api/#jsx-factory): How to transform JSX
38
+ - [`jsxFragmentFactory`](https://esbuild.github.io/api/#jsx-fragment): How to transform JSX Fragments
39
+ - [`jsxImportSource`](https://www.typescriptlang.org/tsconfig#jsxImportSource): Where to import JSX functions from
40
+ - [`allowJs`](https://www.typescriptlang.org/tsconfig#allowJs): Whether to apply the tsconfig to JS files
41
+ - [`paths`](https://www.typescriptlang.org/tsconfig#paths): For resolving aliases
36
42
 
37
43
  #### Custom `tsconfig.json` path
38
44
  By default, `tsconfig.json` will be detected from the current working directory.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var N=require("path"),S=require("fs"),y=require("module"),r=require("@esbuild-kit/core-utils"),i=require("get-tsconfig");function f(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var _=f(N),P=f(S),d=f(y);const E=/^\.{0,2}\//,O=/\.[cm]?tsx?$/,b=`${_.default.sep}node_modules${_.default.sep}`,l=process.env.ESBK_TSCONFIG_PATH?{path:process.env.ESBK_TSCONFIG_PATH,config:i.parseTsconfig(process.env.ESBK_TSCONFIG_PATH)}:i.getTsconfig(),j=l==null?void 0:l.config,v=l&&i.createPathsMatcher(l),h=r.installSourceMapSupport(),x=r.compareNodeVersion([13,2,0])>=0||r.compareNodeVersion([12,20,0])>=0&&r.compareNodeVersion([13,0,0])<0;function T(e,s){process.send&&process.send({type:"dependency",path:s});let t=P.default.readFileSync(s,"utf8");if(s.endsWith(".cjs")&&x){const o=r.transformDynamicImport(s,t);o&&(t=h(o,s))}else{const o=r.transformSync(t,s,{tsconfigRaw:j});t=h(o,s)}e._compile(t,s)}const g=d.default._extensions;[".js",".ts",".tsx",".jsx"].forEach(e=>{g[e]=T}),Object.defineProperty(g,".mjs",{value:T,enumerable:!1});const A=r.compareNodeVersion([16,0,0])>=0||r.compareNodeVersion([14,18,0])>=0,u=d.default._resolveFilename;d.default._resolveFilename=function(e,s,t,o){var n;if(!A&&e.startsWith("node:")&&(e=e.slice(5)),v&&!E.test(e)&&!((n=s==null?void 0:s.filename)!=null&&n.includes(b))){const a=v(e);for(const p of a){const m=F.call(this,p,s,t,o);if(m)return m;try{return u.call(this,p,s,t,o)}catch{}}}const c=F.call(this,e,s,t,o);return c||u.call(this,e,s,t,o)};function F(e,s,t,o){const n=r.resolveTsPath(e);if(s&&O.test(s.filename)&&n)try{return u.call(this,n,s,t,o)}catch(c){const{code:a}=c;if(a!=="MODULE_NOT_FOUND"&&a!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c}}
1
+ "use strict";var S=require("path"),y=require("fs"),P=require("module"),r=require("@esbuild-kit/core-utils"),l=require("get-tsconfig");function f(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var d=f(S),E=f(y),u=f(P);const O=/^\.{0,2}\//,M=/\.[cm]?tsx?$/,b=`${d.default.sep}node_modules${d.default.sep}`,i=process.env.ESBK_TSCONFIG_PATH?{path:d.default.resolve(process.env.ESBK_TSCONFIG_PATH),config:l.parseTsconfig(process.env.ESBK_TSCONFIG_PATH)}:l.getTsconfig(),v=i&&l.createFilesMatcher(i),h=i&&l.createPathsMatcher(i),T=r.installSourceMapSupport(),j=r.compareNodeVersion([13,2,0])>=0||r.compareNodeVersion([12,20,0])>=0&&r.compareNodeVersion([13,0,0])<0;function F(s,e){process.send&&process.send({type:"dependency",path:e});let t=E.default.readFileSync(e,"utf8");if(e.endsWith(".cjs")&&j){const o=r.transformDynamicImport(e,t);o&&(t=T(o,e))}else{const o=r.transformSync(t,e,{tsconfigRaw:v==null?void 0:v(e)});t=T(o,e)}s._compile(t,e)}const g=u.default._extensions;[".js",".ts",".tsx",".jsx"].forEach(s=>{g[s]=F}),Object.defineProperty(g,".mjs",{value:F,enumerable:!1});const x=r.compareNodeVersion([16,0,0])>=0||r.compareNodeVersion([14,18,0])>=0,p=u.default._resolveFilename;u.default._resolveFilename=function(s,e,t,o){var c;if(!x&&s.startsWith("node:")&&(s=s.slice(5)),h&&!O.test(s)&&!((c=e==null?void 0:e.filename)!=null&&c.includes(b))){const a=h(s);for(const m of a){const _=N.call(this,m,e,t,o);if(_)return _;try{return p.call(this,m,e,t,o)}catch{}}}const n=N.call(this,s,e,t,o);return n||p.call(this,s,e,t,o)};function N(s,e,t,o){const c=r.resolveTsPath(s);if(e&&M.test(e.filename)&&c)try{return p.call(this,c,e,t,o)}catch(n){const{code:a}=n;if(a!=="MODULE_NOT_FOUND"&&a!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw n}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esbuild-kit/cjs-loader",
3
- "version": "2.4.1",
3
+ "version": "2.4.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -27,6 +27,6 @@
27
27
  "exports": "./dist/index.js",
28
28
  "dependencies": {
29
29
  "@esbuild-kit/core-utils": "^3.0.0",
30
- "get-tsconfig": "^4.2.0"
30
+ "get-tsconfig": "^4.4.0"
31
31
  }
32
32
  }