@esbuild-kit/cjs-loader 2.3.3 → 2.4.1

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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/dist/index.js +1 -1
  3. package/package.json +31 -59
package/README.md CHANGED
@@ -24,9 +24,9 @@ npm install --save-dev @esbuild-kit/cjs-loader
24
24
 
25
25
  ## Usage
26
26
 
27
- Pass `@esbuild/cjs-loader` into the [`--require`](https://nodejs.org/api/cli.html#-r---require-module) flag
27
+ Pass `@esbuild-kit/cjs-loader` into the [`--require`](https://nodejs.org/api/cli.html#-r---require-module) flag
28
28
  ```sh
29
- node -r @esbuild/cjs-loader ./file.js
29
+ node -r @esbuild-kit/cjs-loader ./file.js
30
30
  ```
31
31
 
32
32
  ### TypeScript configuration
@@ -40,7 +40,7 @@ By default, `tsconfig.json` will be detected from the current working directory.
40
40
  To set a custom path, use the `ESBK_TSCONFIG_PATH` environment variable:
41
41
 
42
42
  ```sh
43
- ESBK_TSCONFIG_PATH=./path/to/tsconfig.custom.json node -r @esbuild/cjs-loader ./file.js
43
+ ESBK_TSCONFIG_PATH=./path/to/tsconfig.custom.json node -r @esbuild-kit/cjs-loader ./file.js
44
44
  ```
45
45
 
46
46
  ### Cache
@@ -49,7 +49,7 @@ Modules transformations are cached in the system cache directory ([`TMPDIR`](htt
49
49
  Set environment variable `ESBK_DISABLE_CACHE` to a truthy value to disable the cache:
50
50
 
51
51
  ```sh
52
- ESBK_DISABLE_CACHE=1 node -r @esbuild/cjs-loader ./file.js
52
+ ESBK_DISABLE_CACHE=1 node -r @esbuild-kit/cjs-loader ./file.js
53
53
  ```
54
54
 
55
55
  ## Related
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var S=require("path"),y=require("fs"),F=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 m=f(S),N=f(y),u=f(F);const P=/^\.{0,2}\//,E=/\.[cm]?tsx?$/,O=`${m.default.sep}node_modules${m.default.sep}`,l=process.env.ESBK_TSCONFIG_PATH?{path:process.env.ESBK_TSCONFIG_PATH,config:i.parseTsconfig(process.env.ESBK_TSCONFIG_PATH)}:i.getTsconfig(),b=l==null?void 0:l.config,_=l&&i.createPathsMatcher(l),h=r.installSourceMapSupport(),j=r.compareNodeVersion([13,2,0])>=0||r.compareNodeVersion([12,20,0])>=0&&r.compareNodeVersion([13,0,0])<0;function v(e,s){process.send&&process.send({type:"dependency",path:s});let t=N.default.readFileSync(s,"utf8");if(s.endsWith(".cjs")&&j){const o=r.transformDynamicImport(t);o&&(t=r.applySourceMap(o,s,h))}else{const o=r.transformSync(t,s,{tsconfigRaw:b});t=r.applySourceMap(o,s,h)}e._compile(t,s)}const T=u.default._extensions;[".js",".ts",".tsx",".jsx"].forEach(e=>{T[e]=v}),Object.defineProperty(T,".mjs",{value:v,enumerable:!1});const x=r.compareNodeVersion([16,0,0])>=0||r.compareNodeVersion([14,18,0])>=0,d=u.default._resolveFilename;u.default._resolveFilename=function(e,s,t,o){if(!x&&e.startsWith("node:")&&(e=e.slice(5)),_&&!P.test(e)&&!(s!=null&&s.filename.includes(O))){const a=_(e);for(const n of a){const p=g.call(this,n,s,t,o);if(p)return p;try{return d.call(this,n,s,t,o)}catch{}}}const c=g.call(this,e,s,t,o);return c||d.call(this,e,s,t,o)};function g(e,s,t,o){const c=r.resolveTsPath(e);if(s&&E.test(s.filename)&&c)try{return d.call(this,c,s,t,o)}catch(a){const{code:n}=a;if(n!=="MODULE_NOT_FOUND"&&n!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw a}}
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}}
package/package.json CHANGED
@@ -1,60 +1,32 @@
1
1
  {
2
- "name": "@esbuild-kit/cjs-loader",
3
- "version": "2.3.3",
4
- "publishConfig": {
5
- "access": "public"
6
- },
7
- "description": "Node.js loader for compiling ESM & TypeScript modules to CommonJS",
8
- "keywords": [
9
- "esbuild",
10
- "loader",
11
- "node",
12
- "cjs",
13
- "commonjs",
14
- "esm",
15
- "typescript"
16
- ],
17
- "license": "MIT",
18
- "repository": "esbuild-kit/cjs-loader",
19
- "author": {
20
- "name": "Hiroki Osame",
21
- "email": "hiroki.osame@gmail.com"
22
- },
23
- "files": [
24
- "dist"
25
- ],
26
- "main": "./dist/index.js",
27
- "exports": "./dist/index.js",
28
- "scripts": {
29
- "build": "pkgroll --target node12.20 --minify",
30
- "lint": "eslint .",
31
- "pretest": "npm run build",
32
- "test": "node --require ./dist/index.js tests/index.ts"
33
- },
34
- "dependencies": {
35
- "@esbuild-kit/core-utils": "^2.1.0",
36
- "get-tsconfig": "^4.1.0"
37
- },
38
- "devDependencies": {
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
- "execa": "^6.1.0",
44
- "get-node": "^13.1.0",
45
- "manten": "^0.2.1",
46
- "pkgroll": "^1.3.1",
47
- "semver": "^7.3.7",
48
- "source-map-support": "^0.5.21",
49
- "typescript": "^4.7.4"
50
- },
51
- "eslintConfig": {
52
- "extends": "@pvtnbr",
53
- "ignorePatterns": [
54
- "tests/fixtures"
55
- ],
56
- "rules": {
57
- "import/no-unresolved": "off"
58
- }
59
- }
60
- }
2
+ "name": "@esbuild-kit/cjs-loader",
3
+ "version": "2.4.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "description": "Node.js loader for compiling ESM & TypeScript modules to CommonJS",
8
+ "keywords": [
9
+ "esbuild",
10
+ "loader",
11
+ "node",
12
+ "cjs",
13
+ "commonjs",
14
+ "esm",
15
+ "typescript"
16
+ ],
17
+ "license": "MIT",
18
+ "repository": "esbuild-kit/cjs-loader",
19
+ "author": {
20
+ "name": "Hiroki Osame",
21
+ "email": "hiroki.osame@gmail.com"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "main": "./dist/index.js",
27
+ "exports": "./dist/index.js",
28
+ "dependencies": {
29
+ "@esbuild-kit/core-utils": "^3.0.0",
30
+ "get-tsconfig": "^4.2.0"
31
+ }
32
+ }