miqro 7.1.0 → 7.2.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/README.md +92 -24
- package/build/esm/editor/auth.js +1 -0
- package/build/esm/editor/auth.js.map +1 -0
- package/build/esm/editor/common/admin-interface.js +1 -0
- package/build/esm/editor/common/admin-interface.js.map +1 -0
- package/build/esm/editor/common/constants.js +1 -0
- package/build/esm/editor/common/constants.js.map +1 -0
- package/build/esm/editor/common/constants.server.js +1 -0
- package/build/esm/editor/common/constants.server.js.map +1 -0
- package/build/esm/editor/common/editor-index.js +1 -0
- package/build/esm/editor/common/editor-index.js.map +1 -0
- package/build/esm/editor/common/html-encode.js +1 -0
- package/build/esm/editor/common/html-encode.js.map +1 -0
- package/build/esm/editor/common/log-socket.js +1 -0
- package/build/esm/editor/common/log-socket.js.map +1 -0
- package/build/esm/editor/common/templates.js +1 -0
- package/build/esm/editor/common/templates.js.map +1 -0
- package/build/esm/editor/components/api-preview.js +1 -0
- package/build/esm/editor/components/api-preview.js.map +1 -0
- package/build/esm/editor/components/editor.js +1 -0
- package/build/esm/editor/components/editor.js.map +1 -0
- package/build/esm/editor/components/file-browser.js +1 -0
- package/build/esm/editor/components/file-browser.js.map +1 -0
- package/build/esm/editor/components/file-editor-toolbar.js +1 -0
- package/build/esm/editor/components/file-editor-toolbar.js.map +1 -0
- package/build/esm/editor/components/file-editor.js +1 -0
- package/build/esm/editor/components/file-editor.js.map +1 -0
- package/build/esm/editor/components/filter-query.js +1 -0
- package/build/esm/editor/components/filter-query.js.map +1 -0
- package/build/esm/editor/components/highlight-text-area.js +1 -0
- package/build/esm/editor/components/highlight-text-area.js.map +1 -0
- package/build/esm/editor/components/log-viewer.js +1 -0
- package/build/esm/editor/components/log-viewer.js.map +1 -0
- package/build/esm/editor/components/new-file.js +1 -0
- package/build/esm/editor/components/new-file.js.map +1 -0
- package/build/esm/editor/components/scroll-query.js +1 -0
- package/build/esm/editor/components/scroll-query.js.map +1 -0
- package/build/esm/editor/components/start-page.js +1 -0
- package/build/esm/editor/components/start-page.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/server/reload.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/server/reload.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js +1 -0
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js.map +1 -0
- package/build/esm/editor/http/admin/editor/editor.js +1 -0
- package/build/esm/editor/http/admin/editor/editor.js.map +1 -0
- package/build/esm/editor/http/admin/editor/index.api.js +1 -0
- package/build/esm/editor/http/admin/editor/index.api.js.map +1 -0
- package/build/esm/editor/server.js +1 -0
- package/build/esm/editor/server.js.map +1 -0
- package/build/esm/editor/ws.js +1 -0
- package/build/esm/editor/ws.js.map +1 -0
- package/build/esm/src/bin/compile.js +1 -0
- package/build/esm/src/bin/compile.js.map +1 -0
- package/build/esm/src/bin/doc-md.js +1 -0
- package/build/esm/src/bin/doc-md.js.map +1 -0
- package/build/esm/src/bin/generate-doc.js +1 -0
- package/build/esm/src/bin/generate-doc.js.map +1 -0
- package/build/esm/src/bin/test.d.ts +2 -1
- package/build/esm/src/bin/test.js +3 -2
- package/build/esm/src/bin/test.js.map +1 -0
- package/build/esm/src/bin/types.js +1 -0
- package/build/esm/src/bin/types.js.map +1 -0
- package/build/esm/src/cluster.js +1 -0
- package/build/esm/src/cluster.js.map +1 -0
- package/build/esm/src/common/arguments.d.ts +8 -0
- package/build/esm/src/common/arguments.js +78 -1
- package/build/esm/src/common/arguments.js.map +1 -0
- package/build/esm/src/common/assets.d.ts +1 -1
- package/build/esm/src/common/assets.js +2 -1
- package/build/esm/src/common/assets.js.map +1 -0
- package/build/esm/src/common/checksum.js +1 -0
- package/build/esm/src/common/checksum.js.map +1 -0
- package/build/esm/src/common/constants.d.ts +1 -0
- package/build/esm/src/common/constants.js +2 -0
- package/build/esm/src/common/constants.js.map +1 -0
- package/build/esm/src/common/content-type.js +1 -0
- package/build/esm/src/common/content-type.js.map +1 -0
- package/build/esm/src/common/esbuild.js +1 -0
- package/build/esm/src/common/esbuild.js.map +1 -0
- package/build/esm/src/common/exit.js +1 -0
- package/build/esm/src/common/exit.js.map +1 -0
- package/build/esm/src/common/fs.js +1 -0
- package/build/esm/src/common/fs.js.map +1 -0
- package/build/esm/src/common/help.d.ts +1 -1
- package/build/esm/src/common/help.js +7 -1
- package/build/esm/src/common/help.js.map +1 -0
- package/build/esm/src/common/jsx.d.ts +20 -16
- package/build/esm/src/common/jsx.js +34 -29
- package/build/esm/src/common/jsx.js.map +1 -0
- package/build/esm/src/common/jwt.js +1 -0
- package/build/esm/src/common/jwt.js.map +1 -0
- package/build/esm/src/common/paths.js +1 -0
- package/build/esm/src/common/paths.js.map +1 -0
- package/build/esm/src/common/watch.js +1 -0
- package/build/esm/src/common/watch.js.map +1 -0
- package/build/esm/src/inflate/inflate-sea.js +1 -0
- package/build/esm/src/inflate/inflate-sea.js.map +1 -0
- package/build/esm/src/inflate/inflate.d.ts +5 -1
- package/build/esm/src/inflate/inflate.js +6 -5
- package/build/esm/src/inflate/inflate.js.map +1 -0
- package/build/esm/src/inflate/md.js +1 -0
- package/build/esm/src/inflate/md.js.map +1 -0
- package/build/esm/src/inflate/setup-auth.d.ts +2 -2
- package/build/esm/src/inflate/setup-auth.js +3 -2
- package/build/esm/src/inflate/setup-auth.js.map +1 -0
- package/build/esm/src/inflate/setup-cors.d.ts +2 -2
- package/build/esm/src/inflate/setup-cors.js +3 -2
- package/build/esm/src/inflate/setup-cors.js.map +1 -0
- package/build/esm/src/inflate/setup-db.d.ts +3 -3
- package/build/esm/src/inflate/setup-db.js +6 -5
- package/build/esm/src/inflate/setup-db.js.map +1 -0
- package/build/esm/src/inflate/setup-error.d.ts +2 -2
- package/build/esm/src/inflate/setup-error.js +3 -2
- package/build/esm/src/inflate/setup-error.js.map +1 -0
- package/build/esm/src/inflate/setup-http.d.ts +7 -2
- package/build/esm/src/inflate/setup-http.js +54 -45
- package/build/esm/src/inflate/setup-http.js.map +1 -0
- package/build/esm/src/inflate/setup-log.d.ts +2 -2
- package/build/esm/src/inflate/setup-log.js +3 -2
- package/build/esm/src/inflate/setup-log.js.map +1 -0
- package/build/esm/src/inflate/setup-middleware.d.ts +2 -2
- package/build/esm/src/inflate/setup-middleware.js +3 -2
- package/build/esm/src/inflate/setup-middleware.js.map +1 -0
- package/build/esm/src/inflate/setup-server-config.d.ts +2 -2
- package/build/esm/src/inflate/setup-server-config.js +3 -2
- package/build/esm/src/inflate/setup-server-config.js.map +1 -0
- package/build/esm/src/inflate/setup-test.d.ts +2 -1
- package/build/esm/src/inflate/setup-test.js +3 -2
- package/build/esm/src/inflate/setup-test.js.map +1 -0
- package/build/esm/src/inflate/setup-ws.d.ts +2 -2
- package/build/esm/src/inflate/setup-ws.js +3 -2
- package/build/esm/src/inflate/setup-ws.js.map +1 -0
- package/build/esm/src/inflate/setup.doc.d.ts +2 -2
- package/build/esm/src/inflate/setup.doc.js +5 -4
- package/build/esm/src/inflate/setup.doc.js.map +1 -0
- package/build/esm/src/inflate/utils/sea-utils.js +1 -0
- package/build/esm/src/inflate/utils/sea-utils.js.map +1 -0
- package/build/esm/src/lib.js +1 -0
- package/build/esm/src/lib.js.map +1 -0
- package/build/esm/src/main.js +9 -2
- package/build/esm/src/main.js.map +1 -0
- package/build/esm/src/services/app.d.ts +5 -2
- package/build/esm/src/services/app.js +19 -6
- package/build/esm/src/services/app.js.map +1 -0
- package/build/esm/src/services/editor.js +1 -0
- package/build/esm/src/services/editor.js.map +1 -0
- package/build/esm/src/services/hot-reload.d.ts +1 -0
- package/build/esm/src/services/hot-reload.js +9 -5
- package/build/esm/src/services/hot-reload.js.map +1 -0
- package/build/esm/src/services/migrations.d.ts +3 -2
- package/build/esm/src/services/migrations.js +5 -4
- package/build/esm/src/services/migrations.js.map +1 -0
- package/build/esm/src/services/utils/admin-interface.js +1 -0
- package/build/esm/src/services/utils/admin-interface.js.map +1 -0
- package/build/esm/src/services/utils/cache.js +1 -0
- package/build/esm/src/services/utils/cache.js.map +1 -0
- package/build/esm/src/services/utils/cluster-cache.js +1 -0
- package/build/esm/src/services/utils/cluster-cache.js.map +1 -0
- package/build/esm/src/services/utils/cluster-ws.js +1 -0
- package/build/esm/src/services/utils/cluster-ws.js.map +1 -0
- package/build/esm/src/services/utils/db-manager.js +1 -0
- package/build/esm/src/services/utils/db-manager.js.map +1 -0
- package/build/esm/src/services/utils/get-route.js +1 -0
- package/build/esm/src/services/utils/get-route.js.map +1 -0
- package/build/esm/src/services/utils/jwt.js +1 -0
- package/build/esm/src/services/utils/jwt.js.map +1 -0
- package/build/esm/src/services/utils/log-transport.js +1 -0
- package/build/esm/src/services/utils/log-transport.js.map +1 -0
- package/build/esm/src/services/utils/log.js +1 -0
- package/build/esm/src/services/utils/log.js.map +1 -0
- package/build/esm/src/services/utils/middleware.js +1 -0
- package/build/esm/src/services/utils/middleware.js.map +1 -0
- package/build/esm/src/services/utils/server-interface.js +1 -0
- package/build/esm/src/services/utils/server-interface.js.map +1 -0
- package/build/esm/src/services/utils/websocketmanager.js +1 -0
- package/build/esm/src/services/utils/websocketmanager.js.map +1 -0
- package/build/esm/src/types.js +1 -0
- package/build/esm/src/types.js.map +1 -0
- package/build/lib.cjs +139 -110
- package/package.json +4 -4
- package/sea/install-esbuild.sh +1 -1
- package/sea/install-nodejs.sh +1 -1
- package/sea/node.version.tag +1 -1
- package/src/bin/test.ts +3 -2
- package/src/common/arguments.ts +92 -1
- package/src/common/assets.ts +2 -2
- package/src/common/constants.ts +1 -0
- package/src/common/help.ts +6 -1
- package/src/common/jsx.ts +41 -30
- package/src/inflate/inflate.ts +9 -5
- package/src/inflate/setup-auth.ts +3 -3
- package/src/inflate/setup-cors.ts +4 -3
- package/src/inflate/setup-db.ts +6 -6
- package/src/inflate/setup-error.ts +3 -3
- package/src/inflate/setup-http.ts +61 -45
- package/src/inflate/setup-log.ts +3 -3
- package/src/inflate/setup-middleware.ts +3 -3
- package/src/inflate/setup-server-config.ts +3 -3
- package/src/inflate/setup-test.ts +3 -3
- package/src/inflate/setup-ws.ts +3 -3
- package/src/inflate/setup.doc.ts +5 -5
- package/src/main.ts +8 -2
- package/src/services/app.ts +24 -9
- package/src/services/hot-reload.ts +9 -5
- package/src/services/migrations.ts +5 -5
package/build/lib.cjs
CHANGED
|
@@ -9171,7 +9171,7 @@ var ASSETS_ROUTER = {
|
|
|
9171
9171
|
};
|
|
9172
9172
|
function getAsset(key) {
|
|
9173
9173
|
if ((0, import_node_sea.isSea)()) {
|
|
9174
|
-
return (0, import_node_sea.getAsset)(key);
|
|
9174
|
+
return Buffer.from((0, import_node_sea.getAsset)(key));
|
|
9175
9175
|
} else {
|
|
9176
9176
|
if (!ASSETS_ROUTER[key]) {
|
|
9177
9177
|
if (key === "esbuild-binary") {
|
|
@@ -9403,6 +9403,7 @@ var EXIT_CODES = {
|
|
|
9403
9403
|
var CLEAR_JSX_CACHE = (process.env["CLEAR_JSX_CACHE"] !== void 0 ? process.env["CLEAR_JSX_CACHE"] : "1") === "1";
|
|
9404
9404
|
var EDITOR_CONFIG_KEY = "$$editor$$";
|
|
9405
9405
|
var HOT_RELOAD_PATH = "/hot-reload";
|
|
9406
|
+
var HOT_RELOAD_SCRIPT_PATH = "/hot-reload.js";
|
|
9406
9407
|
|
|
9407
9408
|
// src/common/jsx.ts
|
|
9408
9409
|
init_types();
|
|
@@ -9611,9 +9612,9 @@ var DocConfigSchema = {
|
|
|
9611
9612
|
}
|
|
9612
9613
|
}
|
|
9613
9614
|
};
|
|
9614
|
-
async function importAPIRoute(inFile, logger) {
|
|
9615
|
+
async function importAPIRoute(inFile, options, logger) {
|
|
9615
9616
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9616
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9617
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9617
9618
|
const module2 = typeof mod === "function" ? { handler: mod } : parser.parse(mod, APIRouteSchema, (0, import_node_path6.basename)(inFile));
|
|
9618
9619
|
if (module2 !== void 0) {
|
|
9619
9620
|
return module2;
|
|
@@ -9621,9 +9622,9 @@ async function importAPIRoute(inFile, logger) {
|
|
|
9621
9622
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9622
9623
|
}
|
|
9623
9624
|
}
|
|
9624
|
-
async function importMigrationModule(inFile, logger) {
|
|
9625
|
+
async function importMigrationModule(inFile, options, logger) {
|
|
9625
9626
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9626
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9627
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9627
9628
|
const module2 = parser.parse(mod, MigrationSchema, (0, import_node_path6.basename)(inFile));
|
|
9628
9629
|
if (module2 !== void 0) {
|
|
9629
9630
|
return module2;
|
|
@@ -9631,8 +9632,8 @@ async function importMigrationModule(inFile, logger) {
|
|
|
9631
9632
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9632
9633
|
}
|
|
9633
9634
|
}
|
|
9634
|
-
async function importHTMLModule(inFile, logger) {
|
|
9635
|
-
const module2 = await importJSXFile(inFile, logger);
|
|
9635
|
+
async function importHTMLModule(inFile, options, logger) {
|
|
9636
|
+
const module2 = await importJSXFile(inFile, options, logger);
|
|
9636
9637
|
parser.parse(module2.default, HTMLModuleSchema.properties.default, `${(0, import_node_path6.basename)(inFile)}.default`);
|
|
9637
9638
|
parser.parse(module2.apiOptions, APIOptionsSchema, `${(0, import_node_path6.basename)(inFile)}.apiOptions`);
|
|
9638
9639
|
if (module2 !== void 0) {
|
|
@@ -9641,8 +9642,8 @@ async function importHTMLModule(inFile, logger) {
|
|
|
9641
9642
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9642
9643
|
}
|
|
9643
9644
|
}
|
|
9644
|
-
async function importJSONModule(inFile, logger) {
|
|
9645
|
-
const module2 = await importJSXFile(inFile, logger);
|
|
9645
|
+
async function importJSONModule(inFile, options, logger) {
|
|
9646
|
+
const module2 = await importJSXFile(inFile, options, logger);
|
|
9646
9647
|
parser.parse(module2.default, JSONModuleSchema.properties.default, `${(0, import_node_path6.basename)(inFile)}.default`);
|
|
9647
9648
|
parser.parse(module2.apiOptions, APIOptionsSchema, `${(0, import_node_path6.basename)(inFile)}.apiOptions`);
|
|
9648
9649
|
if (module2 !== void 0) {
|
|
@@ -9651,9 +9652,9 @@ async function importJSONModule(inFile, logger) {
|
|
|
9651
9652
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9652
9653
|
}
|
|
9653
9654
|
}
|
|
9654
|
-
async function importAuthModule(inFile, logger) {
|
|
9655
|
+
async function importAuthModule(inFile, options, logger) {
|
|
9655
9656
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9656
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9657
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9657
9658
|
const module2 = parser.parse(mod, AuthConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9658
9659
|
if (module2 !== void 0) {
|
|
9659
9660
|
return module2;
|
|
@@ -9661,9 +9662,9 @@ async function importAuthModule(inFile, logger) {
|
|
|
9661
9662
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9662
9663
|
}
|
|
9663
9664
|
}
|
|
9664
|
-
async function importMiddlewareConfigModule(inFile, logger) {
|
|
9665
|
+
async function importMiddlewareConfigModule(inFile, options, logger) {
|
|
9665
9666
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9666
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9667
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9667
9668
|
const module2 = parser.parse(mod, MiddlewareConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9668
9669
|
if (module2 !== void 0) {
|
|
9669
9670
|
return module2;
|
|
@@ -9671,9 +9672,9 @@ async function importMiddlewareConfigModule(inFile, logger) {
|
|
|
9671
9672
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9672
9673
|
}
|
|
9673
9674
|
}
|
|
9674
|
-
async function importErrorConfigModule(inFile, logger) {
|
|
9675
|
+
async function importErrorConfigModule(inFile, options, logger) {
|
|
9675
9676
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9676
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9677
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9677
9678
|
const module2 = parser.parse(mod, ErrorConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9678
9679
|
if (module2 !== void 0) {
|
|
9679
9680
|
return module2;
|
|
@@ -9681,9 +9682,9 @@ async function importErrorConfigModule(inFile, logger) {
|
|
|
9681
9682
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9682
9683
|
}
|
|
9683
9684
|
}
|
|
9684
|
-
async function importDocConfigModule(inFile, logger) {
|
|
9685
|
+
async function importDocConfigModule(inFile, options, logger) {
|
|
9685
9686
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9686
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9687
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9687
9688
|
const module2 = parser.parse(mod, DocConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9688
9689
|
if (module2 !== void 0) {
|
|
9689
9690
|
return module2;
|
|
@@ -9691,9 +9692,9 @@ async function importDocConfigModule(inFile, logger) {
|
|
|
9691
9692
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9692
9693
|
}
|
|
9693
9694
|
}
|
|
9694
|
-
async function importCORSModule(inFile, logger) {
|
|
9695
|
+
async function importCORSModule(inFile, options, logger) {
|
|
9695
9696
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9696
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9697
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9697
9698
|
const module2 = parser.parse(mod, CORSOptionsSchema, (0, import_node_path6.basename)(inFile));
|
|
9698
9699
|
if (module2 !== void 0) {
|
|
9699
9700
|
return module2;
|
|
@@ -9701,9 +9702,9 @@ async function importCORSModule(inFile, logger) {
|
|
|
9701
9702
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9702
9703
|
}
|
|
9703
9704
|
}
|
|
9704
|
-
async function importWSConfigModule(inFile, logger) {
|
|
9705
|
+
async function importWSConfigModule(inFile, options, logger) {
|
|
9705
9706
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9706
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9707
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9707
9708
|
const module2 = parser.parse(mod, WSConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9708
9709
|
if (module2 !== void 0) {
|
|
9709
9710
|
return module2;
|
|
@@ -9711,9 +9712,9 @@ async function importWSConfigModule(inFile, logger) {
|
|
|
9711
9712
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9712
9713
|
}
|
|
9713
9714
|
}
|
|
9714
|
-
async function importDBConfigModule(inFile, logger) {
|
|
9715
|
+
async function importDBConfigModule(inFile, options, logger) {
|
|
9715
9716
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9716
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9717
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9717
9718
|
const module2 = parser.parse(mod, DBConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9718
9719
|
if (module2 !== void 0) {
|
|
9719
9720
|
return module2;
|
|
@@ -9721,17 +9722,17 @@ async function importDBConfigModule(inFile, logger) {
|
|
|
9721
9722
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9722
9723
|
}
|
|
9723
9724
|
}
|
|
9724
|
-
async function importLogConfigModule(inFile, logger) {
|
|
9725
|
-
const module2 = parser.parse((await importJSXFile(inFile, logger)).default, LogConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9725
|
+
async function importLogConfigModule(inFile, options, logger) {
|
|
9726
|
+
const module2 = parser.parse((await importJSXFile(inFile, options, logger)).default, LogConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9726
9727
|
if (module2 !== void 0) {
|
|
9727
9728
|
return module2;
|
|
9728
9729
|
} else {
|
|
9729
9730
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9730
9731
|
}
|
|
9731
9732
|
}
|
|
9732
|
-
async function importServerConfigModule(inFile, logger) {
|
|
9733
|
+
async function importServerConfigModule(inFile, options, logger) {
|
|
9733
9734
|
const isCJS = (0, import_node_path6.extname)(inFile) === ".cjs";
|
|
9734
|
-
const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
|
|
9735
|
+
const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
|
|
9735
9736
|
const module2 = parser.parse(mod, ServerConfigSchema, (0, import_node_path6.basename)(inFile));
|
|
9736
9737
|
if (module2 !== void 0) {
|
|
9737
9738
|
return module2;
|
|
@@ -9739,7 +9740,11 @@ async function importServerConfigModule(inFile, logger) {
|
|
|
9739
9740
|
throw new Error(`error with module [${inFile}] undefined`);
|
|
9740
9741
|
}
|
|
9741
9742
|
}
|
|
9742
|
-
async function importJSXFile(inFile, logger) {
|
|
9743
|
+
async function importJSXFile(inFile, options, logger) {
|
|
9744
|
+
if (options.noBuild) {
|
|
9745
|
+
const module2 = await import((0, import_node_path6.resolve)(inFile));
|
|
9746
|
+
return module2;
|
|
9747
|
+
}
|
|
9743
9748
|
const inflatedCode = await inflateJSX(inFile, {
|
|
9744
9749
|
// embemedJSX: false,
|
|
9745
9750
|
minify: false,
|
|
@@ -12156,8 +12161,7 @@ var CONTENT_TYPE_MAP = {
|
|
|
12156
12161
|
};
|
|
12157
12162
|
|
|
12158
12163
|
// src/services/hot-reload.ts
|
|
12159
|
-
|
|
12160
|
-
const HOT_RELOAD_JS_SCRIPT = `
|
|
12164
|
+
var HOT_RELOAD_JS_SCRIPT = `
|
|
12161
12165
|
// Create WebSocket connection.
|
|
12162
12166
|
|
|
12163
12167
|
function getSocket() {
|
|
@@ -12167,13 +12171,14 @@ function getSocket() {
|
|
|
12167
12171
|
const socket = getSocket();
|
|
12168
12172
|
|
|
12169
12173
|
let timeout;
|
|
12174
|
+
let reloadtimeout;
|
|
12170
12175
|
|
|
12171
12176
|
function tryConnection() {
|
|
12172
12177
|
try {
|
|
12173
12178
|
const newSocket = getSocket();
|
|
12174
12179
|
newSocket.addEventListener("open", (event) => {
|
|
12175
12180
|
console.log("reloading");
|
|
12176
|
-
setTimeout(()=>{
|
|
12181
|
+
reloadtimeout = setTimeout(()=>{
|
|
12177
12182
|
window.location.reload();
|
|
12178
12183
|
}, 500);
|
|
12179
12184
|
|
|
@@ -12191,13 +12196,16 @@ function tryConnection() {
|
|
|
12191
12196
|
// Connection closed
|
|
12192
12197
|
socket.addEventListener("close", (event) => {
|
|
12193
12198
|
clearTimeout(timeout);
|
|
12199
|
+
clearTimeout(reloadtimeout);
|
|
12194
12200
|
timeout = setTimeout(tryConnection, 500);
|
|
12195
12201
|
});
|
|
12196
12202
|
|
|
12197
12203
|
socket.addEventListener("error", (err) => {
|
|
12204
|
+
clearTimeout(reloadtimeout);
|
|
12198
12205
|
console.error(err);
|
|
12199
12206
|
});`;
|
|
12200
|
-
|
|
12207
|
+
function getHotReloadScript() {
|
|
12208
|
+
return `<script src="${HOT_RELOAD_SCRIPT_PATH}"></script>`;
|
|
12201
12209
|
}
|
|
12202
12210
|
|
|
12203
12211
|
// src/inflate/setup-http.ts
|
|
@@ -12208,12 +12216,12 @@ var import_node_fs6 = require("node:fs");
|
|
|
12208
12216
|
init_lib3();
|
|
12209
12217
|
var import_node_path7 = require("node:path");
|
|
12210
12218
|
var import_node_process4 = require("node:process");
|
|
12211
|
-
async function setupCORS(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors) {
|
|
12219
|
+
async function setupCORS(logger, servicePath, service, mainRouter, inflateDir, inflateSea, options, errors) {
|
|
12212
12220
|
const corsPath = getCORSConfigPath(servicePath);
|
|
12213
12221
|
if (corsPath) {
|
|
12214
12222
|
try {
|
|
12215
|
-
const corsOptions = await importCORSModule(corsPath, logger);
|
|
12216
12223
|
logger.debug("setting up cors from [%s]", (0, import_node_path7.join)(service, (0, import_node_path7.basename)(corsPath)));
|
|
12224
|
+
const corsOptions = await importCORSModule(corsPath, options, logger);
|
|
12217
12225
|
mainRouter.use(CORS(corsOptions));
|
|
12218
12226
|
if (inflateDir && inflateSea) {
|
|
12219
12227
|
const inflatePath = (0, import_node_path7.resolve)(inflateDir, service, "cors.cjs");
|
|
@@ -12245,11 +12253,11 @@ init_lib3();
|
|
|
12245
12253
|
var import_node_path8 = require("node:path");
|
|
12246
12254
|
var import_node_fs7 = require("node:fs");
|
|
12247
12255
|
var import_node_process5 = require("node:process");
|
|
12248
|
-
async function setupAUTH(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors) {
|
|
12256
|
+
async function setupAUTH(logger, servicePath, service, mainRouter, inflateDir, inflateSea, options, errors) {
|
|
12249
12257
|
const authPath = getAuthConfigPath(servicePath);
|
|
12250
12258
|
if (authPath) {
|
|
12251
12259
|
try {
|
|
12252
|
-
const authModule = await importAuthModule(authPath, logger);
|
|
12260
|
+
const authModule = await importAuthModule(authPath, options, logger);
|
|
12253
12261
|
logger.debug("setting up authentication from [%s]", (0, import_node_path8.join)(service, (0, import_node_path8.basename)(authPath)));
|
|
12254
12262
|
mainRouter.use(SessionHandler(authModule));
|
|
12255
12263
|
if (inflateDir && inflateSea) {
|
|
@@ -12360,11 +12368,11 @@ function inflateMDString2HTML(text, logger) {
|
|
|
12360
12368
|
var import_node_path10 = require("node:path");
|
|
12361
12369
|
var import_node_fs9 = require("node:fs");
|
|
12362
12370
|
var import_node_process6 = require("node:process");
|
|
12363
|
-
async function setupMiddleware(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors) {
|
|
12371
|
+
async function setupMiddleware(logger, servicePath, service, mainRouter, inflateDir, inflateSea, options, errors) {
|
|
12364
12372
|
const middlewarePath = getMiddlewareConfigPath(servicePath);
|
|
12365
12373
|
if (middlewarePath) {
|
|
12366
12374
|
try {
|
|
12367
|
-
const middewareModule = await importMiddlewareConfigModule(middlewarePath, logger);
|
|
12375
|
+
const middewareModule = await importMiddlewareConfigModule(middlewarePath, options, logger);
|
|
12368
12376
|
logger.debug("setting up middleware from [%s]", (0, import_node_path10.join)(service, (0, import_node_path10.basename)(middlewarePath)));
|
|
12369
12377
|
if (middewareModule && middewareModule.middleware) {
|
|
12370
12378
|
for (const m of middewareModule.middleware) {
|
|
@@ -12402,11 +12410,11 @@ async function setupMiddleware(logger, servicePath, service, mainRouter, inflate
|
|
|
12402
12410
|
var import_node_path11 = require("node:path");
|
|
12403
12411
|
var import_node_fs10 = require("node:fs");
|
|
12404
12412
|
var import_node_process7 = require("node:process");
|
|
12405
|
-
async function setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors) {
|
|
12413
|
+
async function setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, options, errors) {
|
|
12406
12414
|
const errorPath = getErrorConfigPath(servicePath);
|
|
12407
12415
|
if (errorPath) {
|
|
12408
12416
|
try {
|
|
12409
|
-
const errorModule = await importErrorConfigModule(errorPath, logger);
|
|
12417
|
+
const errorModule = await importErrorConfigModule(errorPath, options, logger);
|
|
12410
12418
|
logger.debug("setting up error handling from [%s]", (0, import_node_path11.join)(service, (0, import_node_path11.basename)(errorPath)));
|
|
12411
12419
|
if (errorModule && errorModule.catch) {
|
|
12412
12420
|
for (const m of errorModule.catch) {
|
|
@@ -12439,23 +12447,23 @@ async function setupError(logger, servicePath, service, mainRouter, inflateDir,
|
|
|
12439
12447
|
}
|
|
12440
12448
|
|
|
12441
12449
|
// src/inflate/setup-http.ts
|
|
12442
|
-
async function setupHTTPRouter(server, logger, hotreload, servicePath, service, routeFileMap, staticFileMap, inflateDir, inflateSea, errors, inflateParallel) {
|
|
12450
|
+
async function setupHTTPRouter(importOptions, inflateOptions, server, logger, hotreload, servicePath, service, routeFileMap, staticFileMap, inflateDir, inflateSea, errors, inflateParallel) {
|
|
12443
12451
|
const mainRouter = new Router2();
|
|
12444
12452
|
const apiRouterPath = getHTTPRouterPath(servicePath);
|
|
12445
12453
|
let middlewareConfig = null;
|
|
12446
|
-
await setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors);
|
|
12447
|
-
await setupCORS(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors);
|
|
12448
|
-
await setupAUTH(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors);
|
|
12449
|
-
middlewareConfig = await setupMiddleware(logger, servicePath, service, mainRouter, inflateDir, inflateSea, errors);
|
|
12454
|
+
await setupError(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
|
|
12455
|
+
await setupCORS(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
|
|
12456
|
+
await setupAUTH(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
|
|
12457
|
+
middlewareConfig = await setupMiddleware(logger, servicePath, service, mainRouter, inflateDir, inflateSea, importOptions, errors);
|
|
12450
12458
|
if (apiRouterPath) {
|
|
12451
12459
|
logger.trace("setting up http routes from [%s]", service);
|
|
12452
|
-
const { router: httpRouter } = await createRouterFromDirectory(server, hotreload, service, logger, apiRouterPath, errors, routeFileMap, staticFileMap, inflateDir, inflateSea, inflateParallel);
|
|
12460
|
+
const { router: httpRouter } = await createRouterFromDirectory(importOptions, inflateOptions, server, hotreload, service, logger, apiRouterPath, errors, routeFileMap, staticFileMap, inflateDir, inflateSea, inflateParallel);
|
|
12453
12461
|
mainRouter.use(httpRouter);
|
|
12454
12462
|
}
|
|
12455
12463
|
const staticFilesPath = getStaticFilesPath(servicePath);
|
|
12456
12464
|
if (staticFilesPath) {
|
|
12457
12465
|
logger.trace("setting up static file routes from [%s]", service);
|
|
12458
|
-
const staticRouter = await createStaticRouterFromDirectory(service, logger, staticFilesPath, inflateDir, routeFileMap, staticFileMap, inflateParallel);
|
|
12466
|
+
const staticRouter = await createStaticRouterFromDirectory(inflateOptions, service, logger, staticFilesPath, inflateDir, routeFileMap, staticFileMap, inflateParallel);
|
|
12459
12467
|
mainRouter.use(staticRouter);
|
|
12460
12468
|
}
|
|
12461
12469
|
if (middlewareConfig && middlewareConfig.post) {
|
|
@@ -12465,7 +12473,7 @@ async function setupHTTPRouter(server, logger, hotreload, servicePath, service,
|
|
|
12465
12473
|
}
|
|
12466
12474
|
return mainRouter;
|
|
12467
12475
|
}
|
|
12468
|
-
async function createStaticRoute(service, logger, router, dir, file, inflateDir, routeFileMap, staticFileMap) {
|
|
12476
|
+
async function createStaticRoute(inflateJSXOptions, service, logger, router, dir, file, inflateDir, routeFileMap, staticFileMap) {
|
|
12469
12477
|
return new Promise(async (resolve24, reject) => {
|
|
12470
12478
|
try {
|
|
12471
12479
|
logger.trace("creating static route for [%s]", file.filePath);
|
|
@@ -12484,8 +12492,8 @@ async function createStaticRoute(service, logger, router, dir, file, inflateDir,
|
|
|
12484
12492
|
filePath: file.filePath,
|
|
12485
12493
|
previewMethod: "html"
|
|
12486
12494
|
};
|
|
12487
|
-
if (inflateDir) {
|
|
12488
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", path);
|
|
12495
|
+
if (inflateDir && (inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12496
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path);
|
|
12489
12497
|
(0, import_node_fs11.mkdir)((0, import_node_path12.dirname)(inflatePath), {
|
|
12490
12498
|
recursive: true
|
|
12491
12499
|
}, (err) => {
|
|
@@ -12504,7 +12512,7 @@ async function createStaticRoute(service, logger, router, dir, file, inflateDir,
|
|
|
12504
12512
|
method: "GET",
|
|
12505
12513
|
path: normalizePath2(path),
|
|
12506
12514
|
body: Buffer.from(body),
|
|
12507
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", path) : void 0
|
|
12515
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
|
|
12508
12516
|
};
|
|
12509
12517
|
}
|
|
12510
12518
|
}
|
|
@@ -12540,14 +12548,14 @@ async function createStaticRoute(service, logger, router, dir, file, inflateDir,
|
|
|
12540
12548
|
}
|
|
12541
12549
|
});
|
|
12542
12550
|
}
|
|
12543
|
-
async function createStaticRouterFromDirectory(service, logger, dir, inflateDir, routeFileMap, staticFileMap, inflateParallel) {
|
|
12551
|
+
async function createStaticRouterFromDirectory(inflateOptions, service, logger, dir, inflateDir, routeFileMap, staticFileMap, inflateParallel) {
|
|
12544
12552
|
const router = new Router2();
|
|
12545
12553
|
const maxParallel = inflateParallel ? inflateParallel : 1;
|
|
12546
12554
|
logger.debug("loading static directory with parallel [%s]", maxParallel);
|
|
12547
12555
|
let tR = [];
|
|
12548
12556
|
const files = scanFiles(dir);
|
|
12549
12557
|
for (const file of files) {
|
|
12550
|
-
tR.push(await createStaticRoute(service, logger, router, dir, file, inflateDir, routeFileMap, staticFileMap));
|
|
12558
|
+
tR.push(await createStaticRoute(inflateOptions, service, logger, router, dir, file, inflateDir, routeFileMap, staticFileMap));
|
|
12551
12559
|
if (tR.length >= maxParallel) {
|
|
12552
12560
|
await Promise.all(tR);
|
|
12553
12561
|
tR = [];
|
|
@@ -12559,7 +12567,7 @@ async function createStaticRouterFromDirectory(service, logger, dir, inflateDir,
|
|
|
12559
12567
|
}
|
|
12560
12568
|
return router;
|
|
12561
12569
|
}
|
|
12562
|
-
async function createRouterFromDirectory(server, hotreload, service, logger, dir, errors = [], routeFileMap = {}, staticFileMap = null, inflateDir, inflateSea, inflateParallel) {
|
|
12570
|
+
async function createRouterFromDirectory(importOptions, inflateJSXOptions, server, hotreload, service, logger, dir, errors = [], routeFileMap = {}, staticFileMap = null, inflateDir, inflateSea, inflateParallel) {
|
|
12563
12571
|
const router = new Router2();
|
|
12564
12572
|
const maxParallel = inflateParallel ? inflateParallel : 1;
|
|
12565
12573
|
server.logger.debug("loading http directory with parallel [%s]", maxParallel);
|
|
@@ -12581,7 +12589,11 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12581
12589
|
logger.warn("ignoring [%s]", file.filePath);
|
|
12582
12590
|
return resolve24();
|
|
12583
12591
|
case ".api": {
|
|
12584
|
-
|
|
12592
|
+
if (inflateJSXOptions.inflateOnlyAssets) {
|
|
12593
|
+
logger.warn("ignoring [%s]", file.filePath);
|
|
12594
|
+
return resolve24();
|
|
12595
|
+
}
|
|
12596
|
+
const module2 = await importAPIRoute(file.filePath, importOptions, logger);
|
|
12585
12597
|
const routes = getRoutes((0, import_node_path12.join)("/", (0, import_node_path12.dirname)((0, import_node_path12.relative)(dir, file.filePath))), file.subName, module2);
|
|
12586
12598
|
routeFileMap[file.filePath] = {
|
|
12587
12599
|
routes,
|
|
@@ -12589,7 +12601,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12589
12601
|
filePath: file.filePath,
|
|
12590
12602
|
previewMethod: "api"
|
|
12591
12603
|
};
|
|
12592
|
-
const inflatedCode = inflateDir ? await inflateJSX(file.filePath, {
|
|
12604
|
+
const inflatedCode = inflateDir && inflateSea && (!inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0) ? await inflateJSX(file.filePath, {
|
|
12593
12605
|
// embemedJSX: false,
|
|
12594
12606
|
minify: false,
|
|
12595
12607
|
useExport: true,
|
|
@@ -12599,7 +12611,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12599
12611
|
for (const r of routes) {
|
|
12600
12612
|
if (inflateDir && r.defaultInflatePath && inflateSea) {
|
|
12601
12613
|
const rPath = r.defaultInflatePath;
|
|
12602
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "http", rPath + ".api.cjs");
|
|
12614
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "http", rPath + ".api.cjs");
|
|
12603
12615
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12604
12616
|
recursive: true
|
|
12605
12617
|
});
|
|
@@ -12611,7 +12623,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12611
12623
|
return resolve24();
|
|
12612
12624
|
}
|
|
12613
12625
|
case ".json": {
|
|
12614
|
-
const module2 = await importJSONModule(file.filePath, logger);
|
|
12626
|
+
const module2 = await importJSONModule(file.filePath, importOptions, logger);
|
|
12615
12627
|
const routes = getRoutes((0, import_node_path12.join)("/", (0, import_node_path12.dirname)((0, import_node_path12.relative)(dir, file.filePath))), file.subName + ".json", module2.apiOptions);
|
|
12616
12628
|
routeFileMap[file.filePath] = {
|
|
12617
12629
|
routes,
|
|
@@ -12621,10 +12633,10 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12621
12633
|
};
|
|
12622
12634
|
for (const r of routes) {
|
|
12623
12635
|
const contentType = CONTENT_TYPE_MAP[".json"] ? CONTENT_TYPE_MAP[".json"] : DEFAULT_CONTENT_TYPE;
|
|
12624
|
-
if (inflateDir) {
|
|
12636
|
+
if (inflateDir && (inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12625
12637
|
if (r.inflatePath) {
|
|
12626
12638
|
const rPath = r.inflatePath;
|
|
12627
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", rPath);
|
|
12639
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", rPath);
|
|
12628
12640
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12629
12641
|
recursive: true
|
|
12630
12642
|
});
|
|
@@ -12643,7 +12655,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12643
12655
|
previewMethod: "html",
|
|
12644
12656
|
path: r.path,
|
|
12645
12657
|
body: Buffer.from(JSON_STATIC),
|
|
12646
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", r.inflatePath) : void 0
|
|
12658
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", r.inflatePath) : void 0
|
|
12647
12659
|
};
|
|
12648
12660
|
}
|
|
12649
12661
|
}
|
|
@@ -12662,7 +12674,11 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12662
12674
|
return resolve24();
|
|
12663
12675
|
}
|
|
12664
12676
|
case ".html": {
|
|
12665
|
-
|
|
12677
|
+
if (inflateJSXOptions.inflateOnlyAssets) {
|
|
12678
|
+
logger.warn("ignoring [%s]", file.filePath);
|
|
12679
|
+
return resolve24();
|
|
12680
|
+
}
|
|
12681
|
+
const module2 = await importHTMLModule(file.filePath, importOptions, logger);
|
|
12666
12682
|
const routes = getRoutes((0, import_node_path12.join)("/", (0, import_node_path12.dirname)((0, import_node_path12.relative)(dir, file.filePath))), file.subName + ".html", module2.apiOptions);
|
|
12667
12683
|
routeFileMap[file.filePath] = {
|
|
12668
12684
|
routes,
|
|
@@ -12672,10 +12688,10 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12672
12688
|
};
|
|
12673
12689
|
for (const r of routes) {
|
|
12674
12690
|
const contentType = CONTENT_TYPE_MAP[".html"] ? CONTENT_TYPE_MAP[".html"] : DEFAULT_CONTENT_TYPE;
|
|
12675
|
-
if (inflateDir) {
|
|
12691
|
+
if (inflateDir && (!inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12676
12692
|
if (r.inflatePath) {
|
|
12677
12693
|
const rPath = r.inflatePath;
|
|
12678
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", rPath);
|
|
12694
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", rPath);
|
|
12679
12695
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12680
12696
|
recursive: true
|
|
12681
12697
|
});
|
|
@@ -12687,7 +12703,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12687
12703
|
const HTML_STATIC = await getHTML(hotreload, { server }, null, newURL2(r.path), module2.apiOptions?.basePath, await toRender);
|
|
12688
12704
|
logger.log("writing [%s]", (0, import_node_path12.relative)((0, import_node_process8.cwd)(), inflatePath));
|
|
12689
12705
|
await writeFileASync(inflatePath, HTML_STATIC);
|
|
12690
|
-
if (staticFileMap && inflateSea) {
|
|
12706
|
+
if (staticFileMap && inflateSea && (!inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12691
12707
|
staticFileMap[file.filePath + r.method + r.path] = {
|
|
12692
12708
|
filePath: file.filePath,
|
|
12693
12709
|
contentType,
|
|
@@ -12695,7 +12711,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12695
12711
|
previewMethod: "html",
|
|
12696
12712
|
path: r.path,
|
|
12697
12713
|
body: Buffer.from(HTML_STATIC),
|
|
12698
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", r.inflatePath) : void 0
|
|
12714
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", r.inflatePath) : void 0
|
|
12699
12715
|
};
|
|
12700
12716
|
}
|
|
12701
12717
|
}
|
|
@@ -12718,7 +12734,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12718
12734
|
case ".js":
|
|
12719
12735
|
default: {
|
|
12720
12736
|
if (file.ext !== ".js" && file.ext !== ".ts") {
|
|
12721
|
-
const code = await inflateJSX(file.filePath, {
|
|
12737
|
+
const code = inflateJSXOptions.noMinify ? (0, import_node_fs11.readFileSync)(file.filePath).toString() : await inflateJSX(file.filePath, {
|
|
12722
12738
|
// embemedJSX: true,
|
|
12723
12739
|
minify: file.subExt === ".min" ? true : false,
|
|
12724
12740
|
useExport: true,
|
|
@@ -12735,8 +12751,8 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12735
12751
|
service,
|
|
12736
12752
|
previewMethod: "html"
|
|
12737
12753
|
};
|
|
12738
|
-
if (inflateDir) {
|
|
12739
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", path);
|
|
12754
|
+
if (inflateDir && (inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12755
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path);
|
|
12740
12756
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12741
12757
|
recursive: true
|
|
12742
12758
|
});
|
|
@@ -12750,7 +12766,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12750
12766
|
previewMethod: "html",
|
|
12751
12767
|
path,
|
|
12752
12768
|
body: Buffer.from(code),
|
|
12753
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", path) : void 0
|
|
12769
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
|
|
12754
12770
|
};
|
|
12755
12771
|
}
|
|
12756
12772
|
}
|
|
@@ -12783,8 +12799,8 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12783
12799
|
filePath: file.filePath,
|
|
12784
12800
|
previewMethod: "html"
|
|
12785
12801
|
};
|
|
12786
|
-
if (inflateDir) {
|
|
12787
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", path);
|
|
12802
|
+
if (inflateDir && (inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12803
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path);
|
|
12788
12804
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12789
12805
|
recursive: true
|
|
12790
12806
|
});
|
|
@@ -12798,7 +12814,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12798
12814
|
previewMethod: "html",
|
|
12799
12815
|
path,
|
|
12800
12816
|
body: Buffer.from(code),
|
|
12801
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", path) : void 0
|
|
12817
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
|
|
12802
12818
|
};
|
|
12803
12819
|
}
|
|
12804
12820
|
}
|
|
@@ -12824,7 +12840,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12824
12840
|
}
|
|
12825
12841
|
case ".bundle":
|
|
12826
12842
|
case ".min": {
|
|
12827
|
-
const code = await inflateJSX(file.filePath, {
|
|
12843
|
+
const code = inflateJSXOptions.noMinify ? (0, import_node_fs11.readFileSync)(file.filePath).toString() : await inflateJSX(file.filePath, {
|
|
12828
12844
|
// embemedJSX: false,
|
|
12829
12845
|
minify: file.subExt === ".min" ? true : false,
|
|
12830
12846
|
useExport: true,
|
|
@@ -12841,8 +12857,8 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12841
12857
|
service,
|
|
12842
12858
|
previewMethod: "html"
|
|
12843
12859
|
};
|
|
12844
|
-
if (inflateDir) {
|
|
12845
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", path);
|
|
12860
|
+
if (inflateDir && (inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12861
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path);
|
|
12846
12862
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12847
12863
|
recursive: true
|
|
12848
12864
|
});
|
|
@@ -12856,7 +12872,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12856
12872
|
previewMethod: "html",
|
|
12857
12873
|
path,
|
|
12858
12874
|
body: Buffer.from(code),
|
|
12859
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", path) : void 0
|
|
12875
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
|
|
12860
12876
|
};
|
|
12861
12877
|
}
|
|
12862
12878
|
}
|
|
@@ -12891,8 +12907,8 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12891
12907
|
filePath: file.filePath,
|
|
12892
12908
|
previewMethod: "html"
|
|
12893
12909
|
};
|
|
12894
|
-
if (inflateDir) {
|
|
12895
|
-
const inflatePath = (0, import_node_path12.join)(inflateDir, service, "static", path);
|
|
12910
|
+
if (inflateDir && (inflateJSXOptions.inflateOnlyAssets || inflateJSXOptions.inflateOnlyAssets === void 0)) {
|
|
12911
|
+
const inflatePath = (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path);
|
|
12896
12912
|
await mkdirASync((0, import_node_path12.dirname)(inflatePath), {
|
|
12897
12913
|
recursive: true
|
|
12898
12914
|
});
|
|
@@ -12906,7 +12922,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12906
12922
|
previewMethod: "html",
|
|
12907
12923
|
path,
|
|
12908
12924
|
body: Buffer.from(code),
|
|
12909
|
-
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, service, "static", path) : void 0
|
|
12925
|
+
inflatePath: inflateDir ? (0, import_node_path12.join)(inflateDir, !inflateJSXOptions.inflateFlat ? service : "", "static", path) : void 0
|
|
12910
12926
|
};
|
|
12911
12927
|
}
|
|
12912
12928
|
}
|
|
@@ -12923,7 +12939,7 @@ async function createRouterFromDirectory(server, hotreload, service, logger, dir
|
|
|
12923
12939
|
}
|
|
12924
12940
|
}
|
|
12925
12941
|
}
|
|
12926
|
-
await createStaticRoute(service, logger, router, dir, file, inflateDir, routeFileMap, staticFileMap);
|
|
12942
|
+
await createStaticRoute(inflateJSXOptions, service, logger, router, dir, file, inflateDir, routeFileMap, staticFileMap);
|
|
12927
12943
|
return resolve24();
|
|
12928
12944
|
}
|
|
12929
12945
|
} catch (e) {
|
|
@@ -12971,13 +12987,11 @@ function scanFiles(path, ret = []) {
|
|
|
12971
12987
|
}
|
|
12972
12988
|
function getHTML(hotreload, req, res, url, basePath, out) {
|
|
12973
12989
|
let HTML = `<!DOCTYPE html>
|
|
12974
|
-
${
|
|
12990
|
+
${hotreload ? `${getHotReloadScript()}
|
|
12991
|
+
` : ""}${jsx2HTML(out, createNodeRuntime({
|
|
12975
12992
|
url,
|
|
12976
12993
|
basePath
|
|
12977
12994
|
}))}`;
|
|
12978
|
-
if (hotreload) {
|
|
12979
|
-
HTML += getHotReloadScript();
|
|
12980
|
-
}
|
|
12981
12995
|
return HTML;
|
|
12982
12996
|
}
|
|
12983
12997
|
async function getJSON(req, res, url, basePath, out) {
|
|
@@ -12989,12 +13003,12 @@ async function getJSON(req, res, url, basePath, out) {
|
|
|
12989
13003
|
var import_node_path13 = require("node:path");
|
|
12990
13004
|
var import_node_process9 = require("node:process");
|
|
12991
13005
|
var import_node_fs12 = require("node:fs");
|
|
12992
|
-
async function inflateWSConfig(logger, servicePath, service, wsConfigList, inflateDir, errors) {
|
|
13006
|
+
async function inflateWSConfig(logger, servicePath, service, wsConfigList, inflateDir, errors, options) {
|
|
12993
13007
|
const wsPath = getWSConfigPath(servicePath);
|
|
12994
13008
|
if (wsPath) {
|
|
12995
13009
|
try {
|
|
12996
13010
|
logger.debug("importing websocket socket for service [%s]", service);
|
|
12997
|
-
const wsConfig = await importWSConfigModule(wsPath, logger);
|
|
13011
|
+
const wsConfig = await importWSConfigModule(wsPath, options, logger);
|
|
12998
13012
|
if (wsConfig && wsConfigList.filter((c) => c.path === wsConfig.path).length > 0) {
|
|
12999
13013
|
throw new Error(`ws path [${wsConfig.path}] already defined! from [${wsPath}]`);
|
|
13000
13014
|
} else if (wsConfigList) {
|
|
@@ -13269,11 +13283,11 @@ function writeFile2(logger, path, buffer) {
|
|
|
13269
13283
|
var import_node_path15 = require("node:path");
|
|
13270
13284
|
var import_node_fs14 = require("node:fs");
|
|
13271
13285
|
var import_node_process11 = require("node:process");
|
|
13272
|
-
async function setupLogConfig(logger, servicePath, service, logConfigMap, inflateDir, errors) {
|
|
13286
|
+
async function setupLogConfig(logger, servicePath, service, logConfigMap, inflateDir, options, errors) {
|
|
13273
13287
|
const logPath = getLogConfigPath(servicePath);
|
|
13274
13288
|
if (logPath) {
|
|
13275
13289
|
try {
|
|
13276
|
-
const logConfig = await importLogConfigModule(logPath, logger);
|
|
13290
|
+
const logConfig = await importLogConfigModule(logPath, options, logger);
|
|
13277
13291
|
logConfigMap[service] = logConfig;
|
|
13278
13292
|
if (inflateDir) {
|
|
13279
13293
|
const inflatePath = (0, import_node_path15.resolve)(inflateDir, service, "log.cjs");
|
|
@@ -13569,11 +13583,11 @@ async function getDocOutput(router, fileMap, generateDocAll, generateDocType) {
|
|
|
13569
13583
|
}
|
|
13570
13584
|
|
|
13571
13585
|
// src/inflate/setup.doc.ts
|
|
13572
|
-
async function setupDoc(logger, servicePath, service, mainRouter, fileMap, staticFileMap, inflateDir, errors) {
|
|
13586
|
+
async function setupDoc(logger, servicePath, service, mainRouter, fileMap, staticFileMap, inflateDir, errors, options, inflateFlat) {
|
|
13573
13587
|
const docPath = getDocConfigPath(servicePath);
|
|
13574
13588
|
if (docPath) {
|
|
13575
13589
|
try {
|
|
13576
|
-
const docModule = await importDocConfigModule(docPath, logger);
|
|
13590
|
+
const docModule = await importDocConfigModule(docPath, options, logger);
|
|
13577
13591
|
logger.debug("setting up error handling from [%s]", (0, import_node_path16.join)(service, (0, import_node_path16.basename)(docPath)));
|
|
13578
13592
|
if (docModule && docModule.publish) {
|
|
13579
13593
|
const paths = Object.keys(docModule.publish);
|
|
@@ -13603,7 +13617,7 @@ async function setupDoc(logger, servicePath, service, mainRouter, fileMap, stati
|
|
|
13603
13617
|
}
|
|
13604
13618
|
});
|
|
13605
13619
|
if (inflateDir) {
|
|
13606
|
-
const inflatePath = (0, import_node_path16.join)(inflateDir, service, "static", path);
|
|
13620
|
+
const inflatePath = (0, import_node_path16.join)(inflateDir, !inflateFlat ? service : "", "static", path);
|
|
13607
13621
|
(0, import_node_fs15.mkdirSync)((0, import_node_path16.dirname)(inflatePath), {
|
|
13608
13622
|
recursive: true
|
|
13609
13623
|
});
|
|
@@ -13626,7 +13640,7 @@ async function setupDoc(logger, servicePath, service, mainRouter, fileMap, stati
|
|
|
13626
13640
|
method: "GET",
|
|
13627
13641
|
path,
|
|
13628
13642
|
body: Buffer.from(body),
|
|
13629
|
-
inflatePath: inflateDir ? (0, import_node_path16.join)(inflateDir, service, "static", path) : void 0
|
|
13643
|
+
inflatePath: inflateDir ? (0, import_node_path16.join)(inflateDir, !inflateFlat ? service : "", "static", path) : void 0
|
|
13630
13644
|
};
|
|
13631
13645
|
}
|
|
13632
13646
|
}
|
|
@@ -13645,7 +13659,7 @@ async function setupDoc(logger, servicePath, service, mainRouter, fileMap, stati
|
|
|
13645
13659
|
}
|
|
13646
13660
|
|
|
13647
13661
|
// src/inflate/inflate.ts
|
|
13648
|
-
async function inflateApp({ inflateParallel, serverInterface, logger, hotreload, services, inflateDir, inflateSea, port }) {
|
|
13662
|
+
async function inflateApp({ inflateParallel, serverInterface, logger, hotreload, services, inflateDir, inflateSea, port, noBuild, noMinify, inflateOnlyAssets, inflateFlat }) {
|
|
13649
13663
|
logger.trace("inflateApp");
|
|
13650
13664
|
const errors = [];
|
|
13651
13665
|
let routeFileMap = {};
|
|
@@ -13656,14 +13670,14 @@ async function inflateApp({ inflateParallel, serverInterface, logger, hotreload,
|
|
|
13656
13670
|
const serviceRouteFileMap = {};
|
|
13657
13671
|
const serviceStaticFileMap = inflateSea ? {} : null;
|
|
13658
13672
|
const servicePath = getServicePath(service);
|
|
13659
|
-
await setupLogConfig(logger, servicePath, service, logConfigMap, inflateSea ? inflateDir : false, errors);
|
|
13660
|
-
router.use(await setupHTTPRouter(serverInterface, logger, hotreload ? hotreload : false, servicePath, service, serviceRouteFileMap, serviceStaticFileMap, inflateDir, inflateSea, errors, inflateParallel));
|
|
13673
|
+
await setupLogConfig(logger, servicePath, service, logConfigMap, inflateSea ? inflateDir : false, { noBuild }, errors);
|
|
13674
|
+
router.use(await setupHTTPRouter({ noBuild }, { noMinify, inflateOnlyAssets, inflateFlat }, serverInterface, logger, hotreload ? hotreload : false, servicePath, service, serviceRouteFileMap, serviceStaticFileMap, inflateDir, inflateSea, errors, inflateParallel));
|
|
13661
13675
|
routeFileMap = {
|
|
13662
13676
|
...routeFileMap,
|
|
13663
13677
|
...serviceRouteFileMap
|
|
13664
13678
|
};
|
|
13665
|
-
await setupDoc(logger, servicePath, service, router, routeFileMap, serviceStaticFileMap, inflateDir, errors);
|
|
13666
|
-
await inflateWSConfig(logger, servicePath, service, wsConfigList, inflateSea ? inflateDir : void 0, errors);
|
|
13679
|
+
await setupDoc(logger, servicePath, service, router, routeFileMap, serviceStaticFileMap, inflateDir, errors, { noBuild }, inflateFlat);
|
|
13680
|
+
await inflateWSConfig(logger, servicePath, service, wsConfigList, inflateSea ? inflateDir : void 0, errors, { noBuild });
|
|
13667
13681
|
if (inflateDir && inflateSea) {
|
|
13668
13682
|
await inflateServiceForSea(logger, inflateDir, service, servicePath, serviceRouteFileMap, serviceStaticFileMap);
|
|
13669
13683
|
}
|
|
@@ -13678,11 +13692,11 @@ async function inflateApp({ inflateParallel, serverInterface, logger, hotreload,
|
|
|
13678
13692
|
var import_node_fs16 = require("node:fs");
|
|
13679
13693
|
var import_node_path17 = require("node:path");
|
|
13680
13694
|
var import_node_process13 = require("node:process");
|
|
13681
|
-
async function setupServerConfig(logger, servicePath, service, serverConfigMap, inflateDir, errors) {
|
|
13695
|
+
async function setupServerConfig(logger, servicePath, service, serverConfigMap, inflateDir, errors, options) {
|
|
13682
13696
|
const serverPath = getServerConfigPath(servicePath);
|
|
13683
13697
|
if (serverPath) {
|
|
13684
13698
|
try {
|
|
13685
|
-
const serverConfig = await importServerConfigModule(serverPath, logger);
|
|
13699
|
+
const serverConfig = await importServerConfigModule(serverPath, options, logger);
|
|
13686
13700
|
serverConfigMap[service] = serverConfig;
|
|
13687
13701
|
if (inflateDir) {
|
|
13688
13702
|
const inflatePath = (0, import_node_path17.resolve)(inflateDir, service, "server.cjs");
|
|
@@ -14022,14 +14036,14 @@ function setupExitHandlers(app) {
|
|
|
14022
14036
|
var import_node_path28 = require("node:path");
|
|
14023
14037
|
var import_node_fs25 = require("node:fs");
|
|
14024
14038
|
var import_node_process15 = require("node:process");
|
|
14025
|
-
async function inflateDBConfig(logger, service, dbConfigList, inflateDir, errors) {
|
|
14039
|
+
async function inflateDBConfig(logger, service, dbConfigList, inflateDir, options, errors) {
|
|
14026
14040
|
const servicePath = getServicePath(service);
|
|
14027
14041
|
const dbConfigPath = getDBConfigPath(servicePath);
|
|
14028
14042
|
if (dbConfigPath) {
|
|
14029
14043
|
try {
|
|
14030
|
-
const config = await importDBConfigModule(dbConfigPath, logger);
|
|
14044
|
+
const config = await importDBConfigModule(dbConfigPath, options, logger);
|
|
14031
14045
|
if (config && dbConfigList && dbConfigList.filter((c) => c.name === config.name).length > 0) {
|
|
14032
|
-
throw new Error(`
|
|
14046
|
+
throw new Error(`db name [${config.name}] already defined! error from [${dbConfigPath}]`);
|
|
14033
14047
|
} else if (config) {
|
|
14034
14048
|
if (dbConfigList) {
|
|
14035
14049
|
dbConfigList.push(config);
|
|
@@ -14064,7 +14078,7 @@ async function inflateDBConfig(logger, service, dbConfigList, inflateDir, errors
|
|
|
14064
14078
|
}
|
|
14065
14079
|
return false;
|
|
14066
14080
|
}
|
|
14067
|
-
async function inflateDBMigrations(logger, service, dbName, inflateDir, errors) {
|
|
14081
|
+
async function inflateDBMigrations(logger, service, dbName, inflateDir, options, errors) {
|
|
14068
14082
|
const servicePath = getServicePath(service);
|
|
14069
14083
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
14070
14084
|
if (migrationsFolderPath) {
|
|
@@ -14074,7 +14088,7 @@ async function inflateDBMigrations(logger, service, dbName, inflateDir, errors)
|
|
|
14074
14088
|
for (const migrationName of serviceMigrations) {
|
|
14075
14089
|
const migrationPath = (0, import_node_path28.resolve)(migrationsFolderPath, migrationName);
|
|
14076
14090
|
try {
|
|
14077
|
-
const migrationModule = await importMigrationModule(migrationPath);
|
|
14091
|
+
const migrationModule = await importMigrationModule(migrationPath, options, logger);
|
|
14078
14092
|
migrationModules.push({
|
|
14079
14093
|
name: migrationName,
|
|
14080
14094
|
service,
|
|
@@ -16905,6 +16919,10 @@ var MiqroJSONSchema = {
|
|
|
16905
16919
|
properties: {
|
|
16906
16920
|
name: "string?",
|
|
16907
16921
|
services: "string[]?",
|
|
16922
|
+
noBuild: "boolean?",
|
|
16923
|
+
noMinify: "boolean?",
|
|
16924
|
+
inflateOnlyAssets: "boolean?",
|
|
16925
|
+
inflateFlat: "boolean?",
|
|
16908
16926
|
port: "number?|string?",
|
|
16909
16927
|
inflateDir: "string?",
|
|
16910
16928
|
browser: "boolean?|string?",
|
|
@@ -17037,8 +17055,10 @@ var Miqro = class _Miqro {
|
|
|
17037
17055
|
watcher;
|
|
17038
17056
|
constructor(options) {
|
|
17039
17057
|
this.options = {
|
|
17058
|
+
noMinify: false,
|
|
17040
17059
|
editor: false,
|
|
17041
17060
|
name: "server",
|
|
17061
|
+
noBuild: false,
|
|
17042
17062
|
port: getPORT(),
|
|
17043
17063
|
services: [],
|
|
17044
17064
|
...options ? options : {}
|
|
@@ -17102,6 +17122,7 @@ var Miqro = class _Miqro {
|
|
|
17102
17122
|
name: miqroJSON.name ? miqroJSON.name : void 0,
|
|
17103
17123
|
port: miqroJSON.port ? String(miqroJSON.port) : void 0,
|
|
17104
17124
|
services: miqroJSON.services ? miqroJSON.services.map((s) => (0, import_node_path30.join)((0, import_node_path30.relative)((0, import_node_process16.cwd)(), miqroJSONDir), s)) : void 0,
|
|
17125
|
+
noBuild: miqroJSON.noBuild !== void 0 ? miqroJSON.noBuild : false,
|
|
17105
17126
|
...options ? options : {}
|
|
17106
17127
|
});
|
|
17107
17128
|
await app.inflate({
|
|
@@ -17153,7 +17174,7 @@ var Miqro = class _Miqro {
|
|
|
17153
17174
|
const errors = [];
|
|
17154
17175
|
for (const service of this.options.services) {
|
|
17155
17176
|
const servicePath = getServicePath(service);
|
|
17156
|
-
await setupServerConfig(this.logger, servicePath, service, serverConfigMap, options && options.inflateSea ? options.inflateDir : void 0, errors);
|
|
17177
|
+
await setupServerConfig(this.logger, servicePath, service, serverConfigMap, options && options.inflateSea ? options.inflateDir : void 0, errors, this.options);
|
|
17157
17178
|
}
|
|
17158
17179
|
return {
|
|
17159
17180
|
serverConfigMap,
|
|
@@ -17165,9 +17186,9 @@ var Miqro = class _Miqro {
|
|
|
17165
17186
|
const dbList = [];
|
|
17166
17187
|
const dbConfigListALL = [];
|
|
17167
17188
|
for (const service of this.options.services) {
|
|
17168
|
-
const dbConfig = await inflateDBConfig(this.logger, service, dbConfigListALL, options?.inflateSea ? options?.inflateDir : void 0, errors);
|
|
17189
|
+
const dbConfig = await inflateDBConfig(this.logger, service, dbConfigListALL, options?.inflateSea ? options?.inflateDir : void 0, this.options, errors);
|
|
17169
17190
|
if (dbConfig) {
|
|
17170
|
-
const migrations = await inflateDBMigrations(this.logger, service, dbConfig.name, options?.inflateSea ? options?.inflateDir : void 0, errors);
|
|
17191
|
+
const migrations = await inflateDBMigrations(this.logger, service, dbConfig.name, options?.inflateSea ? options?.inflateDir : void 0, this.options, errors);
|
|
17171
17192
|
dbList.push({
|
|
17172
17193
|
service,
|
|
17173
17194
|
dbConfig,
|
|
@@ -17220,7 +17241,7 @@ var Miqro = class _Miqro {
|
|
|
17220
17241
|
}
|
|
17221
17242
|
try {
|
|
17222
17243
|
this.inflated = void 0;
|
|
17223
|
-
if (_Miqro.initAssetsPromise === null) {
|
|
17244
|
+
if (_Miqro.initAssetsPromise === null && (this.options.noBuild === false || this.options.noMinify === false)) {
|
|
17224
17245
|
_Miqro.initAssetsPromise = initAssets(this.logger);
|
|
17225
17246
|
}
|
|
17226
17247
|
await _Miqro.initAssetsPromise;
|
|
@@ -17242,6 +17263,10 @@ var Miqro = class _Miqro {
|
|
|
17242
17263
|
wsConfigList.push({
|
|
17243
17264
|
path: HOT_RELOAD_PATH
|
|
17244
17265
|
});
|
|
17266
|
+
this.logger?.debug("setting up hot-reload script on [%s]", HOT_RELOAD_SCRIPT_PATH);
|
|
17267
|
+
const hotReloadScriptRouter = new Router2();
|
|
17268
|
+
hotReloadScriptRouter.get(HOT_RELOAD_SCRIPT_PATH, async (req, res) => res.js(HOT_RELOAD_JS_SCRIPT));
|
|
17269
|
+
router.use(hotReloadScriptRouter);
|
|
17245
17270
|
}
|
|
17246
17271
|
await notifiyServerConfig(this.logger, this.serverInterface, this.adminInterface, serverConfigMap, "preload");
|
|
17247
17272
|
const [serviceRouter, errors, fileMap, serviceWSConfigList, serviceLogConfigMap] = await inflateApp({
|
|
@@ -17254,7 +17279,11 @@ var Miqro = class _Miqro {
|
|
|
17254
17279
|
inflateSea: options?.inflateSea ? true : false,
|
|
17255
17280
|
//inflateTests: options?.inflateTests ? true : false,
|
|
17256
17281
|
hotreload: this.options?.hotreload ? true : false,
|
|
17257
|
-
inflateParallel: options?.inflateParallel
|
|
17282
|
+
inflateParallel: options?.inflateParallel,
|
|
17283
|
+
noBuild: this.options?.noBuild,
|
|
17284
|
+
noMinify: this.options?.noMinify,
|
|
17285
|
+
inflateOnlyAssets: options?.inflateOnlyAssets,
|
|
17286
|
+
inflateFlat: options?.inflateFlat
|
|
17258
17287
|
});
|
|
17259
17288
|
wsConfigList.push(...serviceWSConfigList);
|
|
17260
17289
|
router.use(serviceRouter);
|