@mokup/cli 0.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/LICENSE +21 -0
- package/dist/cli.cjs +118 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.mjs +116 -0
- package/dist/index.cjs +16 -0
- package/dist/index.d.cts +20 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.mjs +10 -0
- package/dist/shared/cli.D0D0o7Rg.mjs +714 -0
- package/dist/shared/cli.yAHcdIVy.cjs +717 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ice breaker
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const node_process = require('node:process');
|
|
5
|
+
const index = require('./shared/cli.yAHcdIVy.cjs');
|
|
6
|
+
require('node:fs');
|
|
7
|
+
require('pathe');
|
|
8
|
+
require('node:buffer');
|
|
9
|
+
require('node:module');
|
|
10
|
+
require('node:url');
|
|
11
|
+
require('esbuild');
|
|
12
|
+
require('@mokup/runtime');
|
|
13
|
+
require('jsonc-parser');
|
|
14
|
+
|
|
15
|
+
function parseBuildOptions(argv2) {
|
|
16
|
+
const dirs = [];
|
|
17
|
+
const includes = [];
|
|
18
|
+
const excludes = [];
|
|
19
|
+
let outDir;
|
|
20
|
+
let prefix;
|
|
21
|
+
let handlers = true;
|
|
22
|
+
for (let i = 0; i < argv2.length; i += 1) {
|
|
23
|
+
const arg = argv2[i];
|
|
24
|
+
if (arg === "--dir" || arg === "-d") {
|
|
25
|
+
const value = argv2[i + 1];
|
|
26
|
+
if (value) {
|
|
27
|
+
dirs.push(value);
|
|
28
|
+
i += 1;
|
|
29
|
+
}
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (arg === "--out" || arg === "-o") {
|
|
33
|
+
const value = argv2[i + 1];
|
|
34
|
+
if (value) {
|
|
35
|
+
outDir = value;
|
|
36
|
+
i += 1;
|
|
37
|
+
}
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (arg === "--prefix") {
|
|
41
|
+
const value = argv2[i + 1];
|
|
42
|
+
if (value) {
|
|
43
|
+
prefix = value;
|
|
44
|
+
i += 1;
|
|
45
|
+
}
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (arg === "--include") {
|
|
49
|
+
const value = argv2[i + 1];
|
|
50
|
+
if (value) {
|
|
51
|
+
includes.push(new RegExp(value));
|
|
52
|
+
i += 1;
|
|
53
|
+
}
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (arg === "--exclude") {
|
|
57
|
+
const value = argv2[i + 1];
|
|
58
|
+
if (value) {
|
|
59
|
+
excludes.push(new RegExp(value));
|
|
60
|
+
i += 1;
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (arg === "--no-handlers") {
|
|
65
|
+
handlers = false;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const options2 = {
|
|
70
|
+
handlers,
|
|
71
|
+
log: (message) => console.log(message)
|
|
72
|
+
};
|
|
73
|
+
if (dirs.length > 0) {
|
|
74
|
+
options2.dir = dirs;
|
|
75
|
+
}
|
|
76
|
+
if (outDir) {
|
|
77
|
+
options2.outDir = outDir;
|
|
78
|
+
}
|
|
79
|
+
if (prefix) {
|
|
80
|
+
options2.prefix = prefix;
|
|
81
|
+
}
|
|
82
|
+
if (includes.length > 0) {
|
|
83
|
+
options2.include = includes;
|
|
84
|
+
}
|
|
85
|
+
if (excludes.length > 0) {
|
|
86
|
+
options2.exclude = excludes;
|
|
87
|
+
}
|
|
88
|
+
return options2;
|
|
89
|
+
}
|
|
90
|
+
function printHelp() {
|
|
91
|
+
console.log(
|
|
92
|
+
`mokup build [options]
|
|
93
|
+
|
|
94
|
+
Options:
|
|
95
|
+
--dir, -d Mock directory (repeatable)
|
|
96
|
+
--out, -o Output directory (default: .mokup)
|
|
97
|
+
--prefix URL prefix
|
|
98
|
+
--include Include regex (repeatable)
|
|
99
|
+
--exclude Exclude regex (repeatable)
|
|
100
|
+
--no-handlers Skip function handler output`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
const args = node_process.argv.slice(2);
|
|
104
|
+
const command = args[0];
|
|
105
|
+
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
106
|
+
printHelp();
|
|
107
|
+
node_process.exit(0);
|
|
108
|
+
}
|
|
109
|
+
if (command !== "build") {
|
|
110
|
+
console.error(`Unknown command: ${command}`);
|
|
111
|
+
printHelp();
|
|
112
|
+
node_process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
const options = parseBuildOptions(args.slice(1));
|
|
115
|
+
index.buildManifest(options).catch((error) => {
|
|
116
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
117
|
+
node_process.exit(1);
|
|
118
|
+
});
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { argv, exit } from 'node:process';
|
|
3
|
+
import { b as buildManifest } from './shared/cli.D0D0o7Rg.mjs';
|
|
4
|
+
import 'node:fs';
|
|
5
|
+
import 'pathe';
|
|
6
|
+
import 'node:buffer';
|
|
7
|
+
import 'node:module';
|
|
8
|
+
import 'node:url';
|
|
9
|
+
import 'esbuild';
|
|
10
|
+
import '@mokup/runtime';
|
|
11
|
+
import 'jsonc-parser';
|
|
12
|
+
|
|
13
|
+
function parseBuildOptions(argv2) {
|
|
14
|
+
const dirs = [];
|
|
15
|
+
const includes = [];
|
|
16
|
+
const excludes = [];
|
|
17
|
+
let outDir;
|
|
18
|
+
let prefix;
|
|
19
|
+
let handlers = true;
|
|
20
|
+
for (let i = 0; i < argv2.length; i += 1) {
|
|
21
|
+
const arg = argv2[i];
|
|
22
|
+
if (arg === "--dir" || arg === "-d") {
|
|
23
|
+
const value = argv2[i + 1];
|
|
24
|
+
if (value) {
|
|
25
|
+
dirs.push(value);
|
|
26
|
+
i += 1;
|
|
27
|
+
}
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (arg === "--out" || arg === "-o") {
|
|
31
|
+
const value = argv2[i + 1];
|
|
32
|
+
if (value) {
|
|
33
|
+
outDir = value;
|
|
34
|
+
i += 1;
|
|
35
|
+
}
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (arg === "--prefix") {
|
|
39
|
+
const value = argv2[i + 1];
|
|
40
|
+
if (value) {
|
|
41
|
+
prefix = value;
|
|
42
|
+
i += 1;
|
|
43
|
+
}
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (arg === "--include") {
|
|
47
|
+
const value = argv2[i + 1];
|
|
48
|
+
if (value) {
|
|
49
|
+
includes.push(new RegExp(value));
|
|
50
|
+
i += 1;
|
|
51
|
+
}
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (arg === "--exclude") {
|
|
55
|
+
const value = argv2[i + 1];
|
|
56
|
+
if (value) {
|
|
57
|
+
excludes.push(new RegExp(value));
|
|
58
|
+
i += 1;
|
|
59
|
+
}
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (arg === "--no-handlers") {
|
|
63
|
+
handlers = false;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const options2 = {
|
|
68
|
+
handlers,
|
|
69
|
+
log: (message) => console.log(message)
|
|
70
|
+
};
|
|
71
|
+
if (dirs.length > 0) {
|
|
72
|
+
options2.dir = dirs;
|
|
73
|
+
}
|
|
74
|
+
if (outDir) {
|
|
75
|
+
options2.outDir = outDir;
|
|
76
|
+
}
|
|
77
|
+
if (prefix) {
|
|
78
|
+
options2.prefix = prefix;
|
|
79
|
+
}
|
|
80
|
+
if (includes.length > 0) {
|
|
81
|
+
options2.include = includes;
|
|
82
|
+
}
|
|
83
|
+
if (excludes.length > 0) {
|
|
84
|
+
options2.exclude = excludes;
|
|
85
|
+
}
|
|
86
|
+
return options2;
|
|
87
|
+
}
|
|
88
|
+
function printHelp() {
|
|
89
|
+
console.log(
|
|
90
|
+
`mokup build [options]
|
|
91
|
+
|
|
92
|
+
Options:
|
|
93
|
+
--dir, -d Mock directory (repeatable)
|
|
94
|
+
--out, -o Output directory (default: .mokup)
|
|
95
|
+
--prefix URL prefix
|
|
96
|
+
--include Include regex (repeatable)
|
|
97
|
+
--exclude Exclude regex (repeatable)
|
|
98
|
+
--no-handlers Skip function handler output`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
const args = argv.slice(2);
|
|
102
|
+
const command = args[0];
|
|
103
|
+
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
104
|
+
printHelp();
|
|
105
|
+
exit(0);
|
|
106
|
+
}
|
|
107
|
+
if (command !== "build") {
|
|
108
|
+
console.error(`Unknown command: ${command}`);
|
|
109
|
+
printHelp();
|
|
110
|
+
exit(1);
|
|
111
|
+
}
|
|
112
|
+
const options = parseBuildOptions(args.slice(1));
|
|
113
|
+
buildManifest(options).catch((error) => {
|
|
114
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
115
|
+
exit(1);
|
|
116
|
+
});
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./shared/cli.yAHcdIVy.cjs');
|
|
4
|
+
require('node:fs');
|
|
5
|
+
require('node:process');
|
|
6
|
+
require('pathe');
|
|
7
|
+
require('node:buffer');
|
|
8
|
+
require('node:module');
|
|
9
|
+
require('node:url');
|
|
10
|
+
require('esbuild');
|
|
11
|
+
require('@mokup/runtime');
|
|
12
|
+
require('jsonc-parser');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
exports.buildManifest = index.buildManifest;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Manifest } from '@mokup/runtime';
|
|
2
|
+
|
|
3
|
+
interface BuildOptions {
|
|
4
|
+
dir?: string | string[];
|
|
5
|
+
outDir?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
include?: RegExp | RegExp[];
|
|
8
|
+
exclude?: RegExp | RegExp[];
|
|
9
|
+
handlers?: boolean;
|
|
10
|
+
root?: string;
|
|
11
|
+
log?: (message: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare function buildManifest(options?: BuildOptions): Promise<{
|
|
15
|
+
manifest: Manifest;
|
|
16
|
+
manifestPath: string;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export { buildManifest };
|
|
20
|
+
export type { BuildOptions };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Manifest } from '@mokup/runtime';
|
|
2
|
+
|
|
3
|
+
interface BuildOptions {
|
|
4
|
+
dir?: string | string[];
|
|
5
|
+
outDir?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
include?: RegExp | RegExp[];
|
|
8
|
+
exclude?: RegExp | RegExp[];
|
|
9
|
+
handlers?: boolean;
|
|
10
|
+
root?: string;
|
|
11
|
+
log?: (message: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare function buildManifest(options?: BuildOptions): Promise<{
|
|
15
|
+
manifest: Manifest;
|
|
16
|
+
manifestPath: string;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export { buildManifest };
|
|
20
|
+
export type { BuildOptions };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Manifest } from '@mokup/runtime';
|
|
2
|
+
|
|
3
|
+
interface BuildOptions {
|
|
4
|
+
dir?: string | string[];
|
|
5
|
+
outDir?: string;
|
|
6
|
+
prefix?: string;
|
|
7
|
+
include?: RegExp | RegExp[];
|
|
8
|
+
exclude?: RegExp | RegExp[];
|
|
9
|
+
handlers?: boolean;
|
|
10
|
+
root?: string;
|
|
11
|
+
log?: (message: string) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare function buildManifest(options?: BuildOptions): Promise<{
|
|
15
|
+
manifest: Manifest;
|
|
16
|
+
manifestPath: string;
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export { buildManifest };
|
|
20
|
+
export type { BuildOptions };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { b as buildManifest } from './shared/cli.D0D0o7Rg.mjs';
|
|
2
|
+
import 'node:fs';
|
|
3
|
+
import 'node:process';
|
|
4
|
+
import 'pathe';
|
|
5
|
+
import 'node:buffer';
|
|
6
|
+
import 'node:module';
|
|
7
|
+
import 'node:url';
|
|
8
|
+
import 'esbuild';
|
|
9
|
+
import '@mokup/runtime';
|
|
10
|
+
import 'jsonc-parser';
|