Skip to content

Commit

Permalink
chore: patch tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Feb 3, 2024
1 parent 413a999 commit b897323
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .yarn/patches/tsx-npm-4.7.0-86d7b66640.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
diff --git a/dist/esm/index.mjs b/dist/esm/index.mjs
index db003e02dcd1917f5a4872b3d6cc771abd778c1f..e22a5cbe0e98f5a650223d59aad52a9448788152 100644
--- a/dist/esm/index.mjs
+++ b/dist/esm/index.mjs
@@ -2,4 +2,4 @@ import{isMainThread as F}from"worker_threads";import{i as w,a as v,m as M}from".
The --loader flag was deprecated in Node v20.6.0 and v18.19.0`)},B=()=>`
const require = getBuiltin('module').createRequire("${import.meta.url}");
require('../source-map.cjs').installSourceMapSupport();
-`,d=async(t,r,o)=>{const e=await t(r,o);return!e.format&&e.url.startsWith(k)&&(e.format=await Q(e.url)),e},V=[".js",".json",".ts",".tsx",".jsx"];async function l(t,r,o){const[e,a]=t.split("?");let c;for(const n of V)try{return await d(o,e+n+(a?`?${a}`:""),r)}catch(s){if(c===void 0&&s instanceof Error){const{message:i}=s;s.message=s.message.replace(`${n}'`,"'"),s.stack=s.stack.replace(i,s.message),c=s}}throw c}async function j(t,r,o){const e=S.test(t),a=e?"index":"/index",[c,n]=t.split("?");try{return await l(c+a+(n?`?${n}`:""),r,o)}catch(s){if(!e)try{return await l(t,r,o)}catch{}const i=s,{message:m}=i;throw i.message=i.message.replace(`${a.replace("/",f.sep)}'`,"'"),i.stack=i.stack.replace(m,i.message),i}}const Y=/^\.{1,2}\//,O=async function(t,r,o,e){var a;if(S.test(t))return await j(t,r,o);const c=t.startsWith(k)||Y.test(t);if(E&&!c&&!((a=r.parentURL)!=null&&a.includes("/node_modules/"))){const n=E(t);for(const s of n)try{return await O(U(s).toString(),r,o)}catch{}}if(h.test(r.parentURL)){const n=J(t);if(n)for(const s of n)try{return await d(o,s,r)}catch(i){const{code:m}=i;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw i}}try{return await d(o,t,r)}catch(n){if(n instanceof Error&&!e){const{code:s}=n;if(s==="ERR_UNSUPPORTED_DIR_IMPORT")try{return await j(t,r,o)}catch(i){if(i.code!=="ERR_PACKAGE_IMPORT_NOT_DEFINED")throw i}if(s==="ERR_MODULE_NOT_FOUND")try{return await l(t,r,o)}catch{}}throw n}};let g;b.then(t=>{g=t},()=>{});const y=w(v)?"importAttributes":"importAssertions",Z=async function(t,r,o){var e;g&&g({type:"dependency",path:t}),X.test(t)&&(r[y]||(r[y]={}),r[y].type="json");const a=await o(t,r);if(!a.source)return a;const c=t.startsWith("file://")?P(t):t,n=a.source.toString();if(a.format==="json"||h.test(t)){const s=await D(n,c,{tsconfigRaw:(e=H)==null?void 0:e(c)});return{format:"module",source:R(s)}}if(a.format==="module"){const s=A(c,n);s&&(a.source=R(s))}return a};w(M)&&F&&C();export{B as globalPreload,z as initialize,Z as load,O as resolve};
+`,d=async(t,r,o)=>{const e=await t(r,o);return!e.format&&e.url.startsWith(k)&&(e.format=await Q(e.url)),e},V=[".js",".json",".ts",".tsx",".jsx"];async function l(t,r,o){const[e,a]=t.split("?");let c;for(const n of V)try{return await d(o,e+n+(a?`?${a}`:""),r)}catch(s){if(c===void 0&&s instanceof Error){const{message:i}=s;s.message=s.message.replace(`${n}'`,"'"),s.stack=s.stack.replace(i,s.message),c=s}}throw c}async function j(t,r,o){const e=S.test(t),a=e?"index":"/index",[c,n]=t.split("?");try{return await l(c+a+(n?`?${n}`:""),r,o)}catch(s){if(!e)try{return await l(t,r,o)}catch{}const i=s,{message:m}=i;throw i.message=i.message.replace(`${a.replace("/",f.sep)}'`,"'"),i.stack=i.stack.replace(m,i.message),i}}const Y=/^\.{1,2}\//,O=async function(t,r,o,e){var a;if(S.test(t))return await j(t,r,o);const c=t.startsWith(k)||Y.test(t);if(E&&!c){const n=E(t);for(const s of n)try{return await O(U(s).toString(),r,o)}catch{}}if(h.test(r.parentURL)){const n=J(t);if(n)for(const s of n)try{return await d(o,s,r)}catch(i){const{code:m}=i;if(m!=="ERR_MODULE_NOT_FOUND"&&m!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw i}}try{return await d(o,t,r)}catch(n){if(n instanceof Error&&!e){const{code:s}=n;if(s==="ERR_UNSUPPORTED_DIR_IMPORT")try{return await j(t,r,o)}catch(i){if(i.code!=="ERR_PACKAGE_IMPORT_NOT_DEFINED")throw i}if(s==="ERR_MODULE_NOT_FOUND")try{return await l(t,r,o)}catch{}}throw n}};let g;b.then(t=>{g=t},()=>{});const y=w(v)?"importAttributes":"importAssertions",Z=async function(t,r,o){var e;g&&g({type:"dependency",path:t}),X.test(t)&&(r[y]||(r[y]={}),r[y].type="json");const a=await o(t,r);if(!a.source)return a;const c=t.startsWith("file://")?P(t):t,n=a.source.toString();if(a.format==="json"||h.test(t)){const s=await D(n,c,{tsconfigRaw:(e=H)==null?void 0:e(c)});return{format:"module",source:R(s)}}if(a.format==="module"){const s=A(c,n);s&&(a.source=R(s))}return a};w(M)&&F&&C();export{B as globalPreload,z as initialize,Z as load,O as resolve};
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
],
"license": "MIT",
"scripts": {
"yakumo": "node --import tsx node_modules/yakumo/lib/cli.js",
"build": "tsc -b",
"bump": "yarn yakumo --import tsx version",
"dep": "yarn yakumo --import tsx upgrade",
"pub": "yarn yakumo --import tsx publish",
"bump": "yarn yakumo version",
"dep": "yarn yakumo upgrade",
"pub": "yarn yakumo publish",
"lint": "eslint --cache",
"test": "yarn yakumo --import tsx test -r esbuild-register -t 10000",
"test": "yarn yakumo test --import tsx",
"test:text": "shx rm -rf coverage && c8 -r text yarn test",
"test:json": "shx rm -rf coverage && c8 -r json yarn test",
"test:html": "shx rm -rf coverage && c8 -r html yarn test"
Expand All @@ -29,7 +30,7 @@
"esbuild-register": "^3.5.0",
"eslint": "^8.55.0",
"shx": "^0.3.4",
"tsx": "^4.7.0",
"tsx": "patch:tsx@npm%3A4.7.0#~/.yarn/patches/tsx-npm-4.7.0-86d7b66640.patch",
"typescript": "^5.3.2",
"yakumo": "^1.0.0-beta.5",
"yakumo-esbuild": "^1.0.0-beta.2",
Expand Down
2 changes: 0 additions & 2 deletions packages/cli/src/worker/logger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { apply as logger, Logger } from '@cordisjs/logger'
import Timer from '@cordisjs/timer'
import { Context } from 'cordis'

declare module '@cordisjs/loader' {
Expand Down Expand Up @@ -28,7 +27,6 @@ export function apply(ctx: Context, config: Config = {}) {
ctx.provide('timer', undefined, true)

ctx.plugin(logger)
ctx.plugin(Timer)

function handleException(error: any) {
new Logger('app').error(error)
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"dtsc": "^3.0.1",
"esbuild": "^0.18.20",
"shx": "^0.3.4",
"tsx": "^4.7.0",
"tsx": "patch:tsx@npm%3A4.7.0#~/.yarn/patches/tsx-npm-4.7.0-86d7b66640.patch",
"typescript": "^5.3.2"
},
"dependencies": {
Expand Down

0 comments on commit b897323

Please sign in to comment.