miqro 6.2.12 → 6.2.13
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/build/esm/src/common/arguments.d.ts +2 -0
- package/build/esm/src/common/arguments.js +31 -1
- package/build/esm/src/common/fs.d.ts +6 -0
- package/build/esm/src/common/fs.js +69 -0
- package/build/esm/src/common/help.d.ts +1 -1
- package/build/esm/src/common/help.js +1 -0
- package/build/esm/src/common/jsx.js +22 -22
- package/build/esm/src/inflate/inflate-sea.js +6 -2
- package/build/esm/src/inflate/inflate.d.ts +2 -1
- package/build/esm/src/inflate/inflate.js +2 -2
- package/build/esm/src/inflate/setup-http.d.ts +1 -1
- package/build/esm/src/inflate/setup-http.js +125 -89
- package/build/esm/src/main.js +13 -5
- package/build/esm/src/services/app.d.ts +1 -0
- package/build/esm/src/services/app.js +3 -1
- package/build/lib.cjs +302 -193
- package/package.json +1 -1
- package/src/common/arguments.ts +34 -1
- package/src/common/fs.ts +65 -0
- package/src/common/help.ts +1 -0
- package/src/common/jsx.ts +22 -22
- package/src/inflate/inflate-sea.ts +6 -2
- package/src/inflate/inflate.ts +3 -2
- package/src/inflate/setup-http.ts +127 -91
- package/src/main.ts +13 -5
- package/src/services/app.ts +4 -1
|
@@ -10,6 +10,7 @@ interface MiqroJSON {
|
|
|
10
10
|
https?: boolean;
|
|
11
11
|
serverOptions?: ServerOptions;
|
|
12
12
|
httpsRedirect?: number;
|
|
13
|
+
inflateParallel?: number;
|
|
13
14
|
}
|
|
14
15
|
export declare function importMiqroJSON(inFile: string): MiqroJSON;
|
|
15
16
|
export declare function getPORT(): string;
|
|
@@ -40,6 +41,7 @@ export interface Arguments {
|
|
|
40
41
|
https: boolean;
|
|
41
42
|
serverOptions: ServerOptions;
|
|
42
43
|
httpsRedirect?: number;
|
|
44
|
+
inflateParallel?: number;
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* parse process.argv arguments
|
|
@@ -24,7 +24,8 @@ const MiqroJSONSchema = {
|
|
|
24
24
|
editor: "boolean?",
|
|
25
25
|
https: "boolean?",
|
|
26
26
|
serverOptions: "any?",
|
|
27
|
-
httpsRedirect: "number?"
|
|
27
|
+
httpsRedirect: "number?",
|
|
28
|
+
inflateParallel: "number?"
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
export function importMiqroJSON(inFile) {
|
|
@@ -47,6 +48,7 @@ export function parseArguments() {
|
|
|
47
48
|
//env["LOG_FILE"] = env["LOG_FILE"] ? env["LOG_FILE"] : "./server.log";
|
|
48
49
|
const args = cluster.isPrimary ? process.argv.slice(2, process.argv.length) : process.argv.slice(3, process.argv.length);
|
|
49
50
|
const flags = {
|
|
51
|
+
inflateParallel: null,
|
|
50
52
|
httpsRedirect: null,
|
|
51
53
|
https: null,
|
|
52
54
|
serverOptions: {},
|
|
@@ -392,6 +394,28 @@ export function parseArguments() {
|
|
|
392
394
|
services.push(args[i + 1]);
|
|
393
395
|
i++;
|
|
394
396
|
continue;
|
|
397
|
+
case "--inflate-parallel":
|
|
398
|
+
if (args[i + 1] === undefined) {
|
|
399
|
+
console.error("bad arguments. service directory not provided.");
|
|
400
|
+
console.error(usage);
|
|
401
|
+
process.exit(EXIT_CODES.BAD_ARGUMENTS);
|
|
402
|
+
}
|
|
403
|
+
if (typeof args[i + 1] !== "string") {
|
|
404
|
+
console.error("bad arguments. --inflate-parallel must be a number.");
|
|
405
|
+
console.error(usage);
|
|
406
|
+
process.exit(EXIT_CODES.BAD_ARGUMENTS);
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
const cParallel = parseInt(String(args[i + 1]), 10);
|
|
410
|
+
if (isNaN(cParallel)) {
|
|
411
|
+
console.error("bad arguments. --inflate-parallel must be a number.");
|
|
412
|
+
console.error(usage);
|
|
413
|
+
process.exit(EXIT_CODES.BAD_ARGUMENTS);
|
|
414
|
+
}
|
|
415
|
+
flags.inflateParallel = cParallel;
|
|
416
|
+
}
|
|
417
|
+
i++;
|
|
418
|
+
continue;
|
|
395
419
|
case "--inflate-dir":
|
|
396
420
|
if (flags.inflateDir !== null && flags.compile === null) {
|
|
397
421
|
console.error("bad arguments. --inflate-dir already set.");
|
|
@@ -491,6 +515,11 @@ export function parseArguments() {
|
|
|
491
515
|
flags.editor = miqroRC.editor;
|
|
492
516
|
}
|
|
493
517
|
}
|
|
518
|
+
if (flags.inflateParallel === null) {
|
|
519
|
+
if (miqroRC.inflateParallel !== undefined) {
|
|
520
|
+
flags.inflateParallel = miqroRC.inflateParallel;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
494
523
|
}
|
|
495
524
|
flags.editor = flags.editor ? flags.editor : false;
|
|
496
525
|
if (services.length === 0 && (!flags.installTSConfig && !flags.installTypes && !flags.installMiqroJSON)) {
|
|
@@ -569,6 +598,7 @@ export function parseArguments() {
|
|
|
569
598
|
process.exit(EXIT_CODES.BAD_ARGUMENTS);
|
|
570
599
|
}
|
|
571
600
|
return {
|
|
601
|
+
inflateParallel: flags.inflateParallel ? flags.inflateParallel : undefined,
|
|
572
602
|
name: flags.name ? flags.name : undefined,
|
|
573
603
|
browser: flags.browser !== null ? flags.browser : undefined,
|
|
574
604
|
logFile: flags.logFile !== null ? flags.logFile : undefined,
|
|
@@ -6,3 +6,9 @@ export declare function describeFilePath(filePath: string): {
|
|
|
6
6
|
subName: string;
|
|
7
7
|
filePath: string;
|
|
8
8
|
};
|
|
9
|
+
export declare function mkdirASync(path: string, options?: Partial<{
|
|
10
|
+
recursive: true;
|
|
11
|
+
}>): Promise<void>;
|
|
12
|
+
export declare function writeFileASync(path: string, body?: any): Promise<void>;
|
|
13
|
+
export declare function rmdirASync(path: string): Promise<void>;
|
|
14
|
+
export declare function unlinkASync(path: string): Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mkdir, rmdir, unlink, writeFile } from "node:fs";
|
|
1
2
|
import { basename, extname } from "node:path";
|
|
2
3
|
export function describeFilePath(filePath) {
|
|
3
4
|
const ext = extname(filePath);
|
|
@@ -14,3 +15,71 @@ export function describeFilePath(filePath) {
|
|
|
14
15
|
filePath
|
|
15
16
|
};
|
|
16
17
|
}
|
|
18
|
+
export async function mkdirASync(path, options) {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
try {
|
|
21
|
+
mkdir(path, options, (err) => {
|
|
22
|
+
if (err) {
|
|
23
|
+
reject(err);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
resolve();
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export async function writeFileASync(path, body) {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
try {
|
|
38
|
+
writeFile(path, body, (err) => {
|
|
39
|
+
if (err) {
|
|
40
|
+
reject(err);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
resolve();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
reject(e);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
export async function rmdirASync(path) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
try {
|
|
55
|
+
rmdir(path, (err) => {
|
|
56
|
+
if (err) {
|
|
57
|
+
reject(err);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
resolve();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
reject(e);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export async function unlinkASync(path) {
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
try {
|
|
72
|
+
unlink(path, (err) => {
|
|
73
|
+
if (err) {
|
|
74
|
+
reject(err);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
resolve();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
reject(e);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const BIN_NAME = "miqro";
|
|
2
2
|
export declare const usage = "usage: miqro [...FLAGS] --service app/\n\n==examples==\n\nmiqro --watch --service front/\nPORT=8181 miqro --service api/ --service front/\nmiqro --test --service front/\nmiqro --inflate --service front/\nmiqro --generate-doc --generate-doc-out API.md --service front/\nCLUSTER_COUNT=10 miqro-cluster --service api/";
|
|
3
|
-
export declare const help = "\n==flags==\n\n-v, --version\n\toutputs the version number\n-h, --help\n\toutputs this page.\n--watch\n\tuse to enable the hot-reload functionality.\n--test\n\trun the tests for a service.\n--migrate-up\n\tmigrations up.\n--migrate-down\n\tmigrations down.\n--inflate\n\tinflates the application.\n--inflate-dir\n\tto set the output directory of the --inflate command. default value is inflated/.\n--editor\n\truns the application with a built-in editor.\n--generate-doc\n\tgenerates a documentation for the api endpoints of the service.\n--generate-doc-out\n\tthe output file for the generated documentation. default value is API.md.\n--generate-doc-type\n\tthe format of the generated documentation. it can be JSON or MD. default value is MD.\n--generate-doc-all\n\toutputs all the server routes in the documentation output.\n--compile\n\tinflates the application and tries to create a NODE SEA binary.\n--inflate-sea\n\tinflates the application with sea compilation scripts.\n--install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.\n--install-types\n\tcreates and updates the .types/ folder use together with --install-tsconfig.\n--install-miqrojson\n\tcreates a default miqro.json file.\n--disable-miqrojson\n\tdisables the load of miqro.json file.\n--log-file\n\toverrides the default log file from LOG_FILE.\n--browser\n\toverrides the default browser from BROWSER.\n--config\n\toverrides the default miqro.json path.\n--port\n\toverrides the default port from PORT.\n--name\n\toverrides the default name of the server.\n--https\n\tserves the server in https instead of http\n--https-key\n\tpoint to a server.key file for https.\n--https-cert\n\tpoint to a server.cert file for https.\n--https-redirect\n\tserves an aditional http server that redirects to https. it needs a port number.\n\n==environment variables==\n\nPORT\n\toverride the default 8080 port.\nBROWSER\n\toverride the default browser. change to none to disable.\".\nLOG_FILE\n\toverride the default ./server.log file\nDB\n\tenable the server.db features\nDB_STORAGE\n\toverride the default local db location ./db.sqlite3\nDB_DIALECT\n\toverride the default node:sqlite\nDB_CONNECTION\n\toverride the default connection url\nCLEAR_JSX_CACHE\n\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.\nJSX_TMP\n\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.\n";
|
|
3
|
+
export declare const help = "\n==flags==\n\n-v, --version\n\toutputs the version number\n-h, --help\n\toutputs this page.\n--watch\n\tuse to enable the hot-reload functionality.\n--test\n\trun the tests for a service.\n--migrate-up\n\tmigrations up.\n--migrate-down\n\tmigrations down.\n--inflate\n\tinflates the application.\n--inflate-dir\n\tto set the output directory of the --inflate command. default value is inflated/.\n--editor\n\truns the application with a built-in editor.\n--generate-doc\n\tgenerates a documentation for the api endpoints of the service.\n--generate-doc-out\n\tthe output file for the generated documentation. default value is API.md.\n--generate-doc-type\n\tthe format of the generated documentation. it can be JSON or MD. default value is MD.\n--generate-doc-all\n\toutputs all the server routes in the documentation output.\n--compile\n\tinflates the application and tries to create a NODE SEA binary.\n--inflate-sea\n\tinflates the application with sea compilation scripts.\n--install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.\n--install-types\n\tcreates and updates the .types/ folder use together with --install-tsconfig.\n--install-miqrojson\n\tcreates a default miqro.json file.\n--disable-miqrojson\n\tdisables the load of miqro.json file.\n--log-file\n\toverrides the default log file from LOG_FILE.\n--browser\n\toverrides the default browser from BROWSER.\n--config\n\toverrides the default miqro.json path.\n--port\n\toverrides the default port from PORT.\n--name\n\toverrides the default name of the server.\n--https\n\tserves the server in https instead of http\n--https-key\n\tpoint to a server.key file for https.\n--https-cert\n\tpoint to a server.cert file for https.\n--https-redirect\n\tserves an aditional http server that redirects to https. it needs a port number.\n--inflate-parallel\n\tsets the max parallel esbuild instances. defaults to 1.\n\n==environment variables==\n\nPORT\n\toverride the default 8080 port.\nBROWSER\n\toverride the default browser. change to none to disable.\".\nLOG_FILE\n\toverride the default ./server.log file\nDB\n\tenable the server.db features\nDB_STORAGE\n\toverride the default local db location ./db.sqlite3\nDB_DIALECT\n\toverride the default node:sqlite\nDB_CONNECTION\n\toverride the default connection url\nCLEAR_JSX_CACHE\n\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.\nJSX_TMP\n\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.\n";
|
|
@@ -41,6 +41,7 @@ export const help = `
|
|
|
41
41
|
--https-key\n\tpoint to a server.key file for https.
|
|
42
42
|
--https-cert\n\tpoint to a server.cert file for https.
|
|
43
43
|
--https-redirect\n\tserves an aditional http server that redirects to https. it needs a port number.
|
|
44
|
+
--inflate-parallel\n\tsets the max parallel esbuild instances. defaults to 1.
|
|
44
45
|
|
|
45
46
|
==environment variables==
|
|
46
47
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createNodeRuntime } from "@miqro/jsx-node";
|
|
2
2
|
import { basename, dirname, extname, relative, resolve } from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
|
-
import { mkdirSync, rmdirSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
4
|
import { Parser } from "@miqro/parser";
|
|
6
5
|
import { APIRouteSchema, SessionHandlerOptionsSchema } from "@miqro/core";
|
|
7
6
|
import { cwd } from "node:process";
|
|
@@ -12,6 +11,7 @@ import { CLEAR_JSX_CACHE } from "./constants.js";
|
|
|
12
11
|
import { getAsset, initAsset, validateAsset } from "./assets.js";
|
|
13
12
|
import { calculateChecksumFromBuffer } from "./checksum.js";
|
|
14
13
|
import { HandlerWithOptionsSchema, RouteOptionsSchema } from "@miqro/core/build/types.js";
|
|
14
|
+
import { mkdirASync, rmdirASync, unlinkASync, writeFileASync } from "./fs.js";
|
|
15
15
|
let jsxJSBuffer = null; // Buffer.from(getAsset("jsx.dom.js"));
|
|
16
16
|
let jsxJSBufferChecksumPromise = null; // calculateChecksumFromBuffer(jsxJSBuffer);
|
|
17
17
|
export async function initJSXJS(logger) {
|
|
@@ -40,11 +40,11 @@ export async function inflateJSX(inFile, options) {
|
|
|
40
40
|
const logger = options.logger; //getLogger(`${SERVER_IDENTIFIER}_JSX`);
|
|
41
41
|
try {
|
|
42
42
|
if (!options.embemedJSX) {
|
|
43
|
-
|
|
43
|
+
await mkdirASync(tmpBuildDir, {
|
|
44
44
|
recursive: true
|
|
45
45
|
});
|
|
46
|
-
|
|
47
|
-
//
|
|
46
|
+
await writeFileASync(inFileTmp, browserJSXGlobals(inFile, false, options.useExport));
|
|
47
|
+
//await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), false));
|
|
48
48
|
logger?.trace("inflating [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
|
|
49
49
|
const { outputFiles: [{ contents }] } = await esBuild({
|
|
50
50
|
...DEFAULT_ESOPTION,
|
|
@@ -54,18 +54,18 @@ export async function inflateJSX(inFile, options) {
|
|
|
54
54
|
});
|
|
55
55
|
if (CLEAR_JSX_CACHE) {
|
|
56
56
|
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
await unlinkASync(inFileTmp);
|
|
58
|
+
await rmdirASync(tmpBuildDir);
|
|
59
59
|
}
|
|
60
60
|
return contents;
|
|
61
61
|
}
|
|
62
62
|
else {
|
|
63
|
-
|
|
63
|
+
await mkdirASync(tmpBuildDir, {
|
|
64
64
|
recursive: true
|
|
65
65
|
});
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
//
|
|
66
|
+
//await writeFileASync(jsxJSPath, Buffer.from(getAsset("jsx-dom-bundle")));
|
|
67
|
+
await writeFileASync(inFileTmp, browserJSXGlobals(inFile, jsxJSPath));
|
|
68
|
+
//await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), relative(tmpBuildDir, jsxJSPath)));
|
|
69
69
|
logger?.trace("inflating [%s] from [%s] with jsx.js embedded. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
|
|
70
70
|
const { outputFiles: [{ contents }] } = await esBuild({
|
|
71
71
|
...DEFAULT_ESOPTION,
|
|
@@ -75,9 +75,9 @@ export async function inflateJSX(inFile, options) {
|
|
|
75
75
|
});
|
|
76
76
|
if (CLEAR_JSX_CACHE) {
|
|
77
77
|
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
|
|
78
|
+
await unlinkASync(inFileTmp);
|
|
79
|
+
//await unlinkASync(jsxJSPath);
|
|
80
|
+
await rmdirASync(tmpBuildDir);
|
|
81
81
|
}
|
|
82
82
|
return contents;
|
|
83
83
|
}
|
|
@@ -88,9 +88,9 @@ export async function inflateJSX(inFile, options) {
|
|
|
88
88
|
if (options.embemedJSX) {
|
|
89
89
|
if (CLEAR_JSX_CACHE) {
|
|
90
90
|
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
91
|
-
|
|
92
|
-
//
|
|
93
|
-
|
|
91
|
+
await unlinkASync(inFileTmp);
|
|
92
|
+
//await unlinkASync(jsxJSPath);
|
|
93
|
+
await rmdirASync(tmpBuildDir);
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
96
|
//console.error("errors on: " + tmpBuildDir);
|
|
@@ -427,11 +427,11 @@ export async function importJSXFile(inFile, logger) {
|
|
|
427
427
|
//const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
|
|
428
428
|
const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".cjs");
|
|
429
429
|
//const logger = getLogger(`${SERVER_IDENTIFIER}_JSX`);
|
|
430
|
-
|
|
430
|
+
await mkdirASync(tmpBuildDir, {
|
|
431
431
|
recursive: true
|
|
432
432
|
});
|
|
433
433
|
try {
|
|
434
|
-
|
|
434
|
+
await writeFileASync(inFileTmp, inflatedCode);
|
|
435
435
|
assertGlobalTampered();
|
|
436
436
|
logger?.trace("importing [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
|
|
437
437
|
logger?.debug("importing [%s]", relative(cwd(), inFile));
|
|
@@ -439,8 +439,8 @@ export async function importJSXFile(inFile, logger) {
|
|
|
439
439
|
assertGlobalTampered();
|
|
440
440
|
if (CLEAR_JSX_CACHE) {
|
|
441
441
|
logger?.trace("clearing cache at [%s]. to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
442
|
-
|
|
443
|
-
|
|
442
|
+
await unlinkASync(inFileTmp);
|
|
443
|
+
await rmdirASync(tmpBuildDir);
|
|
444
444
|
}
|
|
445
445
|
return module.default;
|
|
446
446
|
}
|
|
@@ -449,8 +449,8 @@ export async function importJSXFile(inFile, logger) {
|
|
|
449
449
|
logger?.error("error with2: " + inFile);
|
|
450
450
|
if (CLEAR_JSX_CACHE) {
|
|
451
451
|
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
452
|
-
|
|
453
|
-
|
|
452
|
+
await unlinkASync(inFileTmp);
|
|
453
|
+
await rmdirASync(tmpBuildDir);
|
|
454
454
|
}
|
|
455
455
|
else {
|
|
456
456
|
//console.error("errors on: " + tmpBuildDir);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { chmodSync, constants, mkdirSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { chmodSync, constants, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { basename, dirname, extname, join, relative, resolve } from "node:path";
|
|
3
3
|
import { cwd, platform } from "node:process";
|
|
4
|
-
import { getAuthConfigPath, getCORSConfigPath, getDBConfigPath, getErrorConfigPath, getMiddlewareConfigPath, getMigrationsPath, getServerConfigPath, getWSConfigPath } from "../common/paths.js";
|
|
4
|
+
import { getAuthConfigPath, getCORSConfigPath, getDBConfigPath, getErrorConfigPath, getMiddlewareConfigPath, getMigrationsPath, getMiqroJSONPath, getServerConfigPath, getWSConfigPath } from "../common/paths.js";
|
|
5
5
|
import { getAsset } from "../common/assets.js";
|
|
6
6
|
import { migration } from "@miqro/query";
|
|
7
7
|
import { esBuild } from "../common/esbuild.js";
|
|
@@ -104,6 +104,10 @@ main().catch(e=>console.error(e));
|
|
|
104
104
|
platform: "node",
|
|
105
105
|
outfile: join(inflateDir, "sea", "app.bundle.cjs")
|
|
106
106
|
});
|
|
107
|
+
const miqroRCPath = getMiqroJSONPath();
|
|
108
|
+
if (miqroRCPath) {
|
|
109
|
+
writeFile(logger, join(inflateDir, "miqro.json"), readFileSync(miqroRCPath));
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
export async function inflateServiceForSea(logger, inflateDir, service, servicePath /*, serviceMigrations: string[]*/, serviceRouteFileMap, serviceStaticFileMap) {
|
|
109
113
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
@@ -11,5 +11,6 @@ export interface InflateAppOptions {
|
|
|
11
11
|
hotreload?: boolean;
|
|
12
12
|
port: string;
|
|
13
13
|
serverInterface: ServerInterface;
|
|
14
|
+
inflateParallel?: number;
|
|
14
15
|
}
|
|
15
|
-
export declare function inflateApp({ serverInterface, logger, hotreload, services, inflateDir, inflateSea, port }: InflateAppOptions): Promise<[Router, InflateError[] | null, RouteFileMap, WSConfig[], LogConfigMap]>;
|
|
16
|
+
export declare function inflateApp({ inflateParallel, serverInterface, logger, hotreload, services, inflateDir, inflateSea, port }: InflateAppOptions): Promise<[Router, InflateError[] | null, RouteFileMap, WSConfig[], LogConfigMap]>;
|
|
@@ -8,7 +8,7 @@ import { inflateWSConfig } from "./setup-ws.js";
|
|
|
8
8
|
import { inflateAppForSea, inflateServiceForSea } from "./inflate-sea.js";
|
|
9
9
|
import { setupLogConfig } from "./setup-log.js";
|
|
10
10
|
import { setupDoc } from "./setup.doc.js";
|
|
11
|
-
export async function inflateApp({ serverInterface, logger, hotreload, services /*, dbManager*/, inflateDir, inflateSea /*, editor, inflateTests*/, port }) {
|
|
11
|
+
export async function inflateApp({ inflateParallel, serverInterface, logger, hotreload, services /*, dbManager*/, inflateDir, inflateSea /*, editor, inflateTests*/, port }) {
|
|
12
12
|
logger.trace("inflateApp");
|
|
13
13
|
const errors = [];
|
|
14
14
|
//const migrations: string[] = [];
|
|
@@ -43,7 +43,7 @@ export async function inflateApp({ serverInterface, logger, hotreload, services
|
|
|
43
43
|
}*/
|
|
44
44
|
//await setupDB(logger, service, dbConfigList, inflateDir);
|
|
45
45
|
await setupLogConfig(logger, servicePath, service, logConfigMap, inflateSea ? inflateDir : false, errors);
|
|
46
|
-
router.use(await setupHTTPRouter(serverInterface, logger, hotreload ? hotreload : false, servicePath, service, serviceRouteFileMap, serviceStaticFileMap, inflateDir, inflateSea, errors));
|
|
46
|
+
router.use(await setupHTTPRouter(serverInterface, logger, hotreload ? hotreload : false, servicePath, service, serviceRouteFileMap, serviceStaticFileMap, inflateDir, inflateSea, errors, inflateParallel));
|
|
47
47
|
routeFileMap = {
|
|
48
48
|
...routeFileMap,
|
|
49
49
|
...serviceRouteFileMap
|
|
@@ -25,7 +25,7 @@ export interface StaticFileMap {
|
|
|
25
25
|
body: Buffer;
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
export declare function setupHTTPRouter(server: ServerInterface, logger: Logger, hotreload: boolean, servicePath: string, service: string, routeFileMap: RouteFileMap, staticFileMap: StaticFileMap | null, inflateDir: string | undefined | false, inflateSea: boolean, errors: InflateError[]): Promise<Router>;
|
|
28
|
+
export declare function setupHTTPRouter(server: ServerInterface, logger: Logger, hotreload: boolean, servicePath: string, service: string, routeFileMap: RouteFileMap, staticFileMap: StaticFileMap | null, inflateDir: string | undefined | false, inflateSea: boolean, errors: InflateError[], inflateParallel?: number): Promise<Router>;
|
|
29
29
|
interface ScannedFile {
|
|
30
30
|
filePath: string;
|
|
31
31
|
ext: string;
|