@schmock/cli 2.1.2 → 2.1.4
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/bin.js +6 -6
- package/dist/index.js +6 -6
- package/package.json +5 -5
package/dist/bin.js
CHANGED
|
@@ -23635,11 +23635,8 @@ var require_ajv = __commonJS((exports, module) => {
|
|
|
23635
23635
|
|
|
23636
23636
|
// src/cli.ts
|
|
23637
23637
|
import { readFileSync, watch } from "node:fs";
|
|
23638
|
-
import { createServer as createServer2 } from "node:http";
|
|
23639
|
-
import { parseArgs } from "node:util";
|
|
23640
|
-
|
|
23641
|
-
// ../core/src/builder.ts
|
|
23642
23638
|
import { createServer } from "node:http";
|
|
23639
|
+
import { parseArgs } from "node:util";
|
|
23643
23640
|
|
|
23644
23641
|
// ../core/src/constants.ts
|
|
23645
23642
|
var ROUTE_NOT_FOUND_CODE = "ROUTE_NOT_FOUND";
|
|
@@ -24352,6 +24349,9 @@ class CallableMockInstance {
|
|
|
24352
24349
|
if (this.server) {
|
|
24353
24350
|
throw new SchmockError("Server is already running", "SERVER_ALREADY_RUNNING");
|
|
24354
24351
|
}
|
|
24352
|
+
return import("node:http").then(({ createServer }) => this.#startHttpServer(createServer, port, hostname));
|
|
24353
|
+
}
|
|
24354
|
+
#startHttpServer(createServer, port, hostname) {
|
|
24355
24355
|
const httpServer = createServer((req, res) => {
|
|
24356
24356
|
const handleRequest = async () => {
|
|
24357
24357
|
const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
|
|
@@ -24607,7 +24607,7 @@ function schmock(config) {
|
|
|
24607
24607
|
return callableInstance;
|
|
24608
24608
|
}
|
|
24609
24609
|
// ../openapi/package.json
|
|
24610
|
-
var version = "2.1.
|
|
24610
|
+
var version = "2.1.4";
|
|
24611
24611
|
|
|
24612
24612
|
// ../openapi/src/utils.ts
|
|
24613
24613
|
function isRecord(value) {
|
|
@@ -31945,7 +31945,7 @@ async function createCliServer(options) {
|
|
|
31945
31945
|
const port = options.port ?? 3000;
|
|
31946
31946
|
const cors = options.cors ?? false;
|
|
31947
31947
|
const admin = options.admin ?? false;
|
|
31948
|
-
const httpServer =
|
|
31948
|
+
const httpServer = createServer((req, res) => {
|
|
31949
31949
|
if (cors && req.method === "OPTIONS") {
|
|
31950
31950
|
res.writeHead(204, CORS_HEADERS);
|
|
31951
31951
|
res.end();
|
package/dist/index.js
CHANGED
|
@@ -23634,11 +23634,8 @@ var require_ajv = __commonJS((exports, module) => {
|
|
|
23634
23634
|
|
|
23635
23635
|
// src/cli.ts
|
|
23636
23636
|
import { readFileSync, watch } from "node:fs";
|
|
23637
|
-
import { createServer as createServer2 } from "node:http";
|
|
23638
|
-
import { parseArgs } from "node:util";
|
|
23639
|
-
|
|
23640
|
-
// ../core/src/builder.ts
|
|
23641
23637
|
import { createServer } from "node:http";
|
|
23638
|
+
import { parseArgs } from "node:util";
|
|
23642
23639
|
|
|
23643
23640
|
// ../core/src/constants.ts
|
|
23644
23641
|
var ROUTE_NOT_FOUND_CODE = "ROUTE_NOT_FOUND";
|
|
@@ -24351,6 +24348,9 @@ class CallableMockInstance {
|
|
|
24351
24348
|
if (this.server) {
|
|
24352
24349
|
throw new SchmockError("Server is already running", "SERVER_ALREADY_RUNNING");
|
|
24353
24350
|
}
|
|
24351
|
+
return import("node:http").then(({ createServer }) => this.#startHttpServer(createServer, port, hostname));
|
|
24352
|
+
}
|
|
24353
|
+
#startHttpServer(createServer, port, hostname) {
|
|
24354
24354
|
const httpServer = createServer((req, res) => {
|
|
24355
24355
|
const handleRequest = async () => {
|
|
24356
24356
|
const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
|
|
@@ -24606,7 +24606,7 @@ function schmock(config) {
|
|
|
24606
24606
|
return callableInstance;
|
|
24607
24607
|
}
|
|
24608
24608
|
// ../openapi/package.json
|
|
24609
|
-
var version = "2.1.
|
|
24609
|
+
var version = "2.1.4";
|
|
24610
24610
|
|
|
24611
24611
|
// ../openapi/src/utils.ts
|
|
24612
24612
|
function isRecord(value) {
|
|
@@ -31944,7 +31944,7 @@ async function createCliServer(options) {
|
|
|
31944
31944
|
const port = options.port ?? 3000;
|
|
31945
31945
|
const cors = options.cors ?? false;
|
|
31946
31946
|
const admin = options.admin ?? false;
|
|
31947
|
-
const httpServer =
|
|
31947
|
+
const httpServer = createServer((req, res) => {
|
|
31948
31948
|
if (cors && req.method === "OPTIONS") {
|
|
31949
31949
|
res.writeHead(204, CORS_HEADERS);
|
|
31950
31950
|
res.end();
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schmock/cli",
|
|
3
3
|
"description": "CLI for running Schmock mock servers from OpenAPI specs",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"schmock": "
|
|
9
|
+
"schmock": "dist/bin.js"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@schmock/core": "^2.1.
|
|
36
|
-
"@schmock/openapi": "^2.1.
|
|
35
|
+
"@schmock/core": "^2.1.4",
|
|
36
|
+
"@schmock/openapi": "^2.1.4"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@amiceli/vitest-cucumber": "^6.5.0",
|
|
40
40
|
"@types/node": "^25.8.0",
|
|
41
|
-
"vitest": "^4.1.
|
|
41
|
+
"vitest": "^4.1.7"
|
|
42
42
|
}
|
|
43
43
|
}
|