@plugjs/tsrun 0.5.17 → 0.5.18

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.
package/dist/cli.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
3
  }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
6
5
  throw Error('Dynamic require of "' + x + '" is not supported');
7
6
  });
8
7
 
@@ -36,8 +36,7 @@ var ESM = "module";
36
36
  var _debugLog = import_node_util.default.debuglog("plug:ts-loader");
37
37
  var _debug = _debugLog.enabled;
38
38
  function logMessage(mode, arg, ...args) {
39
- if (!_debug)
40
- return;
39
+ if (!_debug) return;
41
40
  const t = mode === ESM ? "esm" : mode === CJS ? "cjs" : "---";
42
41
  _debugLog(`[${t}] ${arg}`, ...args);
43
42
  }
@@ -84,8 +83,7 @@ function moduleType(mode) {
84
83
  }
85
84
  }
86
85
  const parent = import_node_path.default.dirname(directory);
87
- if (directory !== parent)
88
- return _findType(directory);
86
+ if (directory !== parent) return _findType(directory);
89
87
  logMessage(mode, `Type defaulted to "${CJS}"`);
90
88
  return CJS;
91
89
  };
@@ -139,8 +137,7 @@ function esbTranpile(filename, type) {
139
137
  _esbReport("warning", cause.warnings);
140
138
  throwError(type, `ESBuild error transpiling "${filename}"`, { cause, start: esbTranpile });
141
139
  }
142
- if (_debug)
143
- _esbReport("warning", result.warnings);
140
+ if (_debug) _esbReport("warning", result.warnings);
144
141
  return result.code;
145
142
  }
146
143
 
@@ -168,8 +165,7 @@ import_node_module.default._resolveFilename = function(request, parent, ...args)
168
165
  try {
169
166
  return _oldResolveFilename.call(this, request, parent, ...args);
170
167
  } catch (error) {
171
- if (error.code !== "MODULE_NOT_FOUND")
172
- throw error;
168
+ if (error.code !== "MODULE_NOT_FOUND") throw error;
173
169
  const match = request.match(/(.*)(\.[mc]?js$)/);
174
170
  if (parent && match) {
175
171
  const [, name, ext] = match;
@@ -12,8 +12,7 @@ var ESM = "module";
12
12
  var _debugLog = _util.debuglog("plug:ts-loader");
13
13
  var _debug = _debugLog.enabled;
14
14
  function logMessage(mode, arg, ...args) {
15
- if (!_debug)
16
- return;
15
+ if (!_debug) return;
17
16
  const t = mode === ESM ? "esm" : mode === CJS ? "cjs" : "---";
18
17
  _debugLog(`[${t}] ${arg}`, ...args);
19
18
  }
@@ -60,8 +59,7 @@ function moduleType(mode) {
60
59
  }
61
60
  }
62
61
  const parent = _path.dirname(directory);
63
- if (directory !== parent)
64
- return _findType(directory);
62
+ if (directory !== parent) return _findType(directory);
65
63
  logMessage(mode, `Type defaulted to "${CJS}"`);
66
64
  return CJS;
67
65
  };
@@ -115,8 +113,7 @@ function esbTranpile(filename, type) {
115
113
  _esbReport("warning", cause.warnings);
116
114
  throwError(type, `ESBuild error transpiling "${filename}"`, { cause, start: esbTranpile });
117
115
  }
118
- if (_debug)
119
- _esbReport("warning", result.warnings);
116
+ if (_debug) _esbReport("warning", result.warnings);
120
117
  return result.code;
121
118
  }
122
119
  function isFile(path) {
@@ -138,15 +135,11 @@ function isDirectory(path) {
138
135
  var _type = moduleType(CJS);
139
136
  var resolve = (specifier, context, nextResolve) => {
140
137
  logMessage(ESM, `Resolving "${specifier}" from "${context.parentURL}"`);
141
- if (!specifier.match(/^\.\.?\//))
142
- return nextResolve(specifier, context);
138
+ if (!specifier.match(/^\.\.?\//)) return nextResolve(specifier, context);
143
139
  const parentURL = context.parentURL;
144
- if (!parentURL)
145
- return nextResolve(specifier, context);
146
- if (!parentURL.startsWith("file:"))
147
- return nextResolve(specifier, context);
148
- if (!parentURL.match(/\.m?ts$/))
149
- return nextResolve(specifier, context);
140
+ if (!parentURL) return nextResolve(specifier, context);
141
+ if (!parentURL.startsWith("file:")) return nextResolve(specifier, context);
142
+ if (!parentURL.match(/\.m?ts$/)) return nextResolve(specifier, context);
150
143
  const url = new URL(specifier, parentURL).href;
151
144
  const path = _url.fileURLToPath(url);
152
145
  if (isFile(path)) {
@@ -180,11 +173,9 @@ var resolve = (specifier, context, nextResolve) => {
180
173
  };
181
174
  var load = (url, context, nextLoad) => {
182
175
  logMessage(ESM, `Attempting to load "${url}"`);
183
- if (!url.startsWith("file:"))
184
- return nextLoad(url, context);
176
+ if (!url.startsWith("file:")) return nextLoad(url, context);
185
177
  const ext = url.match(/\.[cm]?ts$/)?.[0];
186
- if (!ext)
187
- return nextLoad(url, context);
178
+ if (!ext) return nextLoad(url, context);
188
179
  if (ext === ".cts") {
189
180
  logMessage(ESM, `Switching type from "module" to "commonjs" for "${url}"`);
190
181
  logMessage(ESM, "Please note that named import WILL NOT WORK in this case, as Node.js performs a");
package/dist/parser.mjs CHANGED
@@ -1,8 +1,7 @@
1
1
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
2
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
3
  }) : x)(function(x) {
4
- if (typeof require !== "undefined")
5
- return require.apply(this, arguments);
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
6
5
  throw Error('Dynamic require of "' + x + '" is not supported');
7
6
  });
8
7
 
package/dist/tsrun.mjs CHANGED
@@ -2,8 +2,7 @@
2
2
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
3
3
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
4
4
  }) : x)(function(x) {
5
- if (typeof require !== "undefined")
6
- return require.apply(this, arguments);
5
+ if (typeof require !== "undefined") return require.apply(this, arguments);
7
6
  throw Error('Dynamic require of "' + x + '" is not supported');
8
7
  });
9
8
 
@@ -1091,7 +1090,7 @@ function _help() {
1091
1090
  ${$blu}${$und}Options:${$rst}
1092
1091
 
1093
1092
  ${$wht}-h --help ${$rst} Help! You're reading it now!
1094
- ${$wht}-v --version ${$rst} Version! This one: ${"0.5.17"}!
1093
+ ${$wht}-v --version ${$rst} Version! This one: ${"0.5.18"}!
1095
1094
  ${$wht}-e --eval ${$rst} Evaluate the script
1096
1095
  ${$wht}-p --print ${$rst} Evaluate the script and print the result
1097
1096
  ${$wht} --force-esm${$rst} Force transpilation of ".ts" files to EcmaScript modules
@@ -1134,7 +1133,7 @@ main(import.meta.url, (args) => {
1134
1133
  case "help":
1135
1134
  return _help();
1136
1135
  case "version":
1137
- console.log(`v${"0.5.17"}`);
1136
+ console.log(`v${"0.5.18"}`);
1138
1137
  process.exitCode = 1;
1139
1138
  return;
1140
1139
  case "eval":
@@ -1148,13 +1147,12 @@ main(import.meta.url, (args) => {
1148
1147
  }
1149
1148
  if (!_script) {
1150
1149
  return new Promise((resolve2, reject) => {
1151
- console.log(`Welcome to Node.js ${process.version} (tsrun v${"0.5.17"}).`);
1150
+ console.log(`Welcome to Node.js ${process.version} (tsrun v${"0.5.18"}).`);
1152
1151
  console.log('Type ".help" for more information.');
1153
1152
  const repl = _repl.start();
1154
1153
  const history = _path.resolve(_os.homedir(), ".node_repl_history");
1155
1154
  repl.setupHistory(history, (error) => {
1156
- if (!error)
1157
- return;
1155
+ if (!error) return;
1158
1156
  reject(error);
1159
1157
  repl.close();
1160
1158
  });
@@ -1177,8 +1175,7 @@ main(import.meta.url, (args) => {
1177
1175
  return require('node:vm').runInThisContext(${JSON.stringify(_script)}, '[eval]')
1178
1176
  `;
1179
1177
  const result = new _module2("[eval]")._compile(script, "[eval]");
1180
- if (_print)
1181
- console.log(result);
1178
+ if (_print) console.log(result);
1182
1179
  } else {
1183
1180
  _script = _path.resolve(process.cwd(), _script);
1184
1181
  process.argv = [process.argv0, _script, ..._scriptArgs];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plugjs/tsrun",
3
- "version": "0.5.17",
3
+ "version": "0.5.18",
4
4
  "type": "module",
5
5
  "module": "./dist/cli.mjs",
6
6
  "types": "./dist/cli.d.mts",
@@ -22,7 +22,7 @@
22
22
  "author": "Juit Developers <developers@juit.com>",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "esbuild": "^0.20.2"
25
+ "esbuild": "^0.21.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@plugjs/eslint-plugin": "^0.1.21",