uni-run 1.1.22 → 1.1.24

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/app.js CHANGED
@@ -44,8 +44,12 @@ const scriptExecutors_1 = __importDefault(require("./scriptExecutors"));
44
44
  const checkRuntime_1 = __importDefault(require("./scriptExecutors/checkRuntime"));
45
45
  const getUserExecutors_1 = __importDefault(require("./helpers/getUserExecutors"));
46
46
  const helpers_1 = require("./scriptExecutors/helpers");
47
+ const local_env_1 = require("./local-env");
47
48
  arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* ([script, listArs, trailingArgs], flags) {
48
49
  var _b;
50
+ if ((0, local_env_1.getRuntime)() === 'rux') {
51
+ flags.exit = true;
52
+ }
49
53
  const executionConfig = (0, getConfig_1.default)(flags.cwd);
50
54
  const userExecutors = (0, getUserExecutors_1.default)(flags.cwd);
51
55
  const totalExecutors = [
@@ -67,6 +71,9 @@ arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* (
67
71
  exec.start();
68
72
  }));
69
73
  arg.exec.on(([listArs, trailingArgs], flags) => {
74
+ if ((0, local_env_1.getRuntime)() === 'rux') {
75
+ flags.exit = true;
76
+ }
70
77
  new execution_1.default((0, argHelper_1.mapFlagsToOptions)(flags), [...listArs, ...trailingArgs]).start();
71
78
  });
72
79
  arg.list.on(() => {
package/dist/arg.d.ts CHANGED
@@ -35,7 +35,7 @@ export declare const app: NoArg<"uni-run", {
35
35
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
36
36
  }>;
37
37
  readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
38
- description: "Do not watch the script. Just run it once and exit";
38
+ description: "Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`";
39
39
  }>;
40
40
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
41
41
  aliases: ["s"];
@@ -132,7 +132,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
132
132
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
133
133
  }>;
134
134
  readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
135
- description: "Do not watch the script. Just run it once and exit";
135
+ description: "Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`";
136
136
  }>;
137
137
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
138
138
  aliases: ["s"];
@@ -15,7 +15,7 @@ export declare const executionConfig: {
15
15
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
16
16
  }>;
17
17
  readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
18
- description: "Do not watch the script. Just run it once and exit";
18
+ description: "Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`";
19
19
  }>;
20
20
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
21
21
  aliases: ["s"];
package/dist/argHelper.js CHANGED
@@ -17,7 +17,7 @@ exports.executionConfig = noarg_1.default.defineConfig({
17
17
  'disable-raw-stdin': noarg_1.default.boolean()
18
18
  .aliases('drs')
19
19
  .description('Disable raw mode for stdin. Do not needed with `--disable-reload-key`'),
20
- exit: noarg_1.default.boolean().description('Do not watch the script. Just run it once and exit'),
20
+ exit: noarg_1.default.boolean().description('Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`'),
21
21
  silent: noarg_1.default.boolean()
22
22
  .aliases('s')
23
23
  .description('Do not show any output of the script'),
package/dist/bix.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './app';
package/dist/bix.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ require("./app");
5
+ const arg_1 = require("./arg");
6
+ const local_env_1 = require("./local-env");
7
+ (0, local_env_1.setRuntime)('rux');
8
+ arg_1.app.start();
@@ -0,0 +1,4 @@
1
+ type Runtime = 'run' | 'rux';
2
+ export declare function setRuntime(runtime: Runtime): void;
3
+ export declare function getRuntime(): string;
4
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setRuntime = setRuntime;
4
+ exports.getRuntime = getRuntime;
5
+ let RUNTIME = 'run';
6
+ function setRuntime(runtime) {
7
+ RUNTIME = runtime;
8
+ }
9
+ function getRuntime() {
10
+ return RUNTIME;
11
+ }
@@ -1,3 +1,3 @@
1
- export declare function getUniqueCacheDir(slug: string): string;
1
+ export declare function getOutputFileName(slug: string): string;
2
2
  export declare function getCacheDir(): string;
3
3
  export declare function cleanCacheDir(): void;
@@ -3,14 +3,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getUniqueCacheDir = getUniqueCacheDir;
6
+ exports.getOutputFileName = getOutputFileName;
7
7
  exports.getCacheDir = getCacheDir;
8
8
  exports.cleanCacheDir = cleanCacheDir;
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const utils_1 = require("../helpers/utils");
11
11
  const cacheDir = path_1.default.join(__dirname, '../../.cache');
12
- function getUniqueCacheDir(slug) {
13
- return (0, utils_1.emptyDir)(cacheDir, slug + '-' + `${process.pid}-${process.ppid}`);
12
+ function getOutputFileName(slug) {
13
+ const ext = process.platform === 'win32' ? '.exe' : '';
14
+ const dir = (0, utils_1.emptyDir)(cacheDir, slug + '-' + `${process.pid}-${process.ppid}`);
15
+ return path_1.default.join(dir, 'output' + ext);
14
16
  }
15
17
  function getCacheDir() {
16
18
  return cacheDir;
@@ -231,7 +231,7 @@ exports.default = (0, as_1.default)([
231
231
  name: 'C - GCC',
232
232
  exts: ['c'],
233
233
  getRuntime([script, ...args], options, config) {
234
- const output = (0, helpers_1.getUniqueCacheDir)('/c-gcc') + '/output';
234
+ const output = (0, helpers_1.getOutputFileName)('/c-gcc');
235
235
  return {
236
236
  compile: ['gcc', script, '-o', output],
237
237
  exec: [output, ...args],
@@ -243,7 +243,7 @@ exports.default = (0, as_1.default)([
243
243
  name: 'C++ - GCC',
244
244
  exts: ['cpp'],
245
245
  getRuntime([script, ...args], options, config) {
246
- const output = (0, helpers_1.getUniqueCacheDir)('/cpp-gcc') + '/output';
246
+ const output = (0, helpers_1.getOutputFileName)('/cpp-gcc');
247
247
  return {
248
248
  compile: ['g++', script, '-o', output],
249
249
  exec: [output, ...args],
@@ -255,7 +255,7 @@ exports.default = (0, as_1.default)([
255
255
  name: 'C# - Mono (Windows)',
256
256
  exts: ['cs'],
257
257
  getRuntime([script, ...args], options, config) {
258
- const output = (0, helpers_1.getUniqueCacheDir)('/cs-mono') + '/output.exe';
258
+ const output = (0, helpers_1.getOutputFileName)('/cs-mono');
259
259
  return {
260
260
  compile: ['mcs', '-out:' + output, script],
261
261
  exec: [output, ...args],
@@ -267,7 +267,7 @@ exports.default = (0, as_1.default)([
267
267
  name: 'Rust - rustc',
268
268
  exts: ['rs'],
269
269
  getRuntime([script, ...args], options, config) {
270
- const output = (0, helpers_1.getUniqueCacheDir)('/rust-rustc') + '/output';
270
+ const output = (0, helpers_1.getOutputFileName)('/rust-rustc');
271
271
  return {
272
272
  compile: ['rustc', script, '-o', output],
273
273
  exec: [output, ...args],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.22",
3
+ "version": "1.1.24",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {
@@ -15,7 +15,9 @@
15
15
  "main": "./dist/index.js",
16
16
  "bin": {
17
17
  "run": "./dist/bin.js",
18
- "uni-run": "./dist/bin.js"
18
+ "rux": "./dist/bix.js",
19
+ "uni-run": "./dist/bin.js",
20
+ "uni-rux": "./dist/bix.js"
19
21
  },
20
22
  "dependencies": {
21
23
  "@inquirer/confirm": "^5.1.19",