exupery-core-bin 0.1.0 → 0.1.2

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/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
- export * from "./run_program";
2
- export * from "./bin_api";
3
- export * from "./bin_glossary";
1
+ import * as _et from 'exupery-core-types';
2
+ export type Program_Main = ($: _et.Array<string>) => _et.Async_Value<number>;
3
+ /**
4
+ * Runs a program main function, passing command line arguments (excluding
5
+ * `node` and the script name), and setting the process exit code to the
6
+ * returned value when the async value completes.
7
+ */
8
+ export declare const run_program: (main: Program_Main) => void;
package/dist/index.js CHANGED
@@ -10,10 +10,29 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
15
24
  };
16
25
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./run_program"), exports);
18
- __exportStar(require("./bin_api"), exports);
19
- __exportStar(require("./bin_glossary"), exports);
26
+ exports.run_program = void 0;
27
+ const _ei = __importStar(require("exupery-core-internals"));
28
+ /**
29
+ * Runs a program main function, passing command line arguments (excluding
30
+ * `node` and the script name), and setting the process exit code to the
31
+ * returned value when the async value completes.
32
+ */
33
+ const run_program = (main) => {
34
+ main(_ei.array_literal(process.argv.slice(2))).__execute(($) => {
35
+ process.exitCode = $;
36
+ });
37
+ };
38
+ exports.run_program = run_program;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exupery-core-bin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "license": "ISC",
5
5
  "description": "this is one of the core packages for Exupery. it provides functionality to create executables",
6
6
  "author": "Corno",
@@ -20,7 +20,7 @@
20
20
  "dist"
21
21
  ],
22
22
  "devDependencies": {
23
- "@types/node": "^18.11.9"
23
+ "@types/node": "^24.5.2"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
package/dist/bin_api.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import * as g_pi from "./bin_glossary";
2
- export declare namespace DEP {
3
- }
4
- export declare namespace API {
5
- type main = ($: null, $d: null, $se: null) => g_pi.A.Main;
6
- }
package/dist/bin_api.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,31 +0,0 @@
1
- import * as pt from 'exupery-core-types';
2
- export declare namespace G { }
3
- export declare namespace N { }
4
- export declare namespace D {
5
- namespace Command__Line__Arguments {
6
- namespace _larguments {
7
- type A = string;
8
- }
9
- type _larguments = pt.Array<string>;
10
- }
11
- type Command__Line__Arguments = {
12
- readonly 'arguments': pt.Array<string>;
13
- };
14
- type Exit__code = number;
15
- type Message = string;
16
- }
17
- export declare namespace I {
18
- type Exit = ($: D.Exit__code) => void;
19
- type Main = ($: D.Command__Line__Arguments) => void;
20
- type Message__Stream = {
21
- 'data': ($: D.Message) => void;
22
- 'end': () => void;
23
- };
24
- }
25
- export declare namespace A {
26
- type Main = ($is: {
27
- readonly 'exit': I.Exit;
28
- readonly 'stderr': I.Message__Stream;
29
- readonly 'stdout': I.Message__Stream;
30
- }) => I.Main;
31
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +0,0 @@
1
- import * as api from "./bin_api";
2
- export declare function run_program(main_creator: api.API.main): void;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.run_program = run_program;
27
- const pi = __importStar(require("exupery-core-internals"));
28
- const process = __importStar(require("process"));
29
- function run_program(main_creator) {
30
- main_creator(null, null, null)({
31
- 'exit': ($) => {
32
- process.exit($);
33
- },
34
- 'stderr': {
35
- 'data': ($) => {
36
- process.stderr.write($);
37
- },
38
- 'end': () => {
39
- }
40
- },
41
- 'stdout': {
42
- 'data': ($) => {
43
- process.stdout.write($);
44
- },
45
- 'end': () => {
46
- }
47
- }
48
- })({
49
- 'arguments': pi.array_literal(process.argv.slice(2)) //strip 'node' and the script name
50
- });
51
- }