mokup 0.2.2 → 1.0.0

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-bin.cjs CHANGED
@@ -1,110 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- const node_process = require('node:process');
4
+ const process = require('node:process');
5
5
  const cli = require('@mokup/cli');
6
6
 
7
- function parseBuildOptions(argv2) {
8
- const dirs = [];
9
- const includes = [];
10
- const excludes = [];
11
- let outDir;
12
- let prefix;
13
- let handlers = true;
14
- for (let i = 0; i < argv2.length; i += 1) {
15
- const arg = argv2[i];
16
- if (arg === "--dir" || arg === "-d") {
17
- const value = argv2[i + 1];
18
- if (value) {
19
- dirs.push(value);
20
- i += 1;
21
- }
22
- continue;
23
- }
24
- if (arg === "--out" || arg === "-o") {
25
- const value = argv2[i + 1];
26
- if (value) {
27
- outDir = value;
28
- i += 1;
29
- }
30
- continue;
31
- }
32
- if (arg === "--prefix") {
33
- const value = argv2[i + 1];
34
- if (value) {
35
- prefix = value;
36
- i += 1;
37
- }
38
- continue;
39
- }
40
- if (arg === "--include") {
41
- const value = argv2[i + 1];
42
- if (value) {
43
- includes.push(new RegExp(value));
44
- i += 1;
45
- }
46
- continue;
47
- }
48
- if (arg === "--exclude") {
49
- const value = argv2[i + 1];
50
- if (value) {
51
- excludes.push(new RegExp(value));
52
- i += 1;
53
- }
54
- continue;
55
- }
56
- if (arg === "--no-handlers") {
57
- handlers = false;
58
- continue;
59
- }
60
- }
61
- const options2 = {
62
- handlers,
63
- log: (message) => console.log(message)
64
- };
65
- if (dirs.length > 0) {
66
- options2.dir = dirs;
67
- }
68
- if (outDir) {
69
- options2.outDir = outDir;
70
- }
71
- if (prefix) {
72
- options2.prefix = prefix;
73
- }
74
- if (includes.length > 0) {
75
- options2.include = includes;
76
- }
77
- if (excludes.length > 0) {
78
- options2.exclude = excludes;
79
- }
80
- return options2;
81
- }
82
- function printHelp() {
83
- console.log(
84
- `mokup build [options]
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
85
8
 
86
- Options:
87
- --dir, -d Mock directory (repeatable)
88
- --out, -o Output directory (default: .mokup)
89
- --prefix URL prefix
90
- --include Include regex (repeatable)
91
- --exclude Exclude regex (repeatable)
92
- --no-handlers Skip function handler output`
93
- );
94
- }
95
- const args = node_process.argv.slice(2);
96
- const command = args[0];
97
- if (!command || command === "help" || command === "--help" || command === "-h") {
98
- printHelp();
99
- node_process.exit(0);
100
- }
101
- if (command !== "build") {
102
- console.error(`Unknown command: ${command}`);
103
- printHelp();
104
- node_process.exit(1);
105
- }
106
- const options = parseBuildOptions(args.slice(1));
107
- cli.buildManifest(options).catch((error) => {
9
+ const process__default = /*#__PURE__*/_interopDefaultCompat(process);
10
+
11
+ cli.runCli().catch((error) => {
108
12
  console.error(error instanceof Error ? error.message : String(error));
109
- node_process.exit(1);
13
+ process__default.exit(1);
110
14
  });
package/dist/cli-bin.mjs CHANGED
@@ -1,108 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { argv, exit } from 'node:process';
3
- import { buildManifest } from '@mokup/cli';
2
+ import process from 'node:process';
3
+ import { runCli } from '@mokup/cli';
4
4
 
5
- function parseBuildOptions(argv2) {
6
- const dirs = [];
7
- const includes = [];
8
- const excludes = [];
9
- let outDir;
10
- let prefix;
11
- let handlers = true;
12
- for (let i = 0; i < argv2.length; i += 1) {
13
- const arg = argv2[i];
14
- if (arg === "--dir" || arg === "-d") {
15
- const value = argv2[i + 1];
16
- if (value) {
17
- dirs.push(value);
18
- i += 1;
19
- }
20
- continue;
21
- }
22
- if (arg === "--out" || arg === "-o") {
23
- const value = argv2[i + 1];
24
- if (value) {
25
- outDir = value;
26
- i += 1;
27
- }
28
- continue;
29
- }
30
- if (arg === "--prefix") {
31
- const value = argv2[i + 1];
32
- if (value) {
33
- prefix = value;
34
- i += 1;
35
- }
36
- continue;
37
- }
38
- if (arg === "--include") {
39
- const value = argv2[i + 1];
40
- if (value) {
41
- includes.push(new RegExp(value));
42
- i += 1;
43
- }
44
- continue;
45
- }
46
- if (arg === "--exclude") {
47
- const value = argv2[i + 1];
48
- if (value) {
49
- excludes.push(new RegExp(value));
50
- i += 1;
51
- }
52
- continue;
53
- }
54
- if (arg === "--no-handlers") {
55
- handlers = false;
56
- continue;
57
- }
58
- }
59
- const options2 = {
60
- handlers,
61
- log: (message) => console.log(message)
62
- };
63
- if (dirs.length > 0) {
64
- options2.dir = dirs;
65
- }
66
- if (outDir) {
67
- options2.outDir = outDir;
68
- }
69
- if (prefix) {
70
- options2.prefix = prefix;
71
- }
72
- if (includes.length > 0) {
73
- options2.include = includes;
74
- }
75
- if (excludes.length > 0) {
76
- options2.exclude = excludes;
77
- }
78
- return options2;
79
- }
80
- function printHelp() {
81
- console.log(
82
- `mokup build [options]
83
-
84
- Options:
85
- --dir, -d Mock directory (repeatable)
86
- --out, -o Output directory (default: .mokup)
87
- --prefix URL prefix
88
- --include Include regex (repeatable)
89
- --exclude Exclude regex (repeatable)
90
- --no-handlers Skip function handler output`
91
- );
92
- }
93
- const args = argv.slice(2);
94
- const command = args[0];
95
- if (!command || command === "help" || command === "--help" || command === "-h") {
96
- printHelp();
97
- exit(0);
98
- }
99
- if (command !== "build") {
100
- console.error(`Unknown command: ${command}`);
101
- printHelp();
102
- exit(1);
103
- }
104
- const options = parseBuildOptions(args.slice(1));
105
- buildManifest(options).catch((error) => {
5
+ runCli().catch((error) => {
106
6
  console.error(error instanceof Error ? error.message : String(error));
107
- exit(1);
7
+ process.exit(1);
108
8
  });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { MiddlewareHandler, Context } from 'hono';
1
+ import { MiddlewareHandler, Context } from '@mokup/shared/hono';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
4
4
  type MockContext = Context;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { MiddlewareHandler, Context } from 'hono';
1
+ import { MiddlewareHandler, Context } from '@mokup/shared/hono';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
4
4
  type MockContext = Context;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { MiddlewareHandler, Context } from 'hono';
1
+ import { MiddlewareHandler, Context } from '@mokup/shared/hono';
2
2
 
3
3
  type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
4
4
  type MockContext = Context;