miqro 6.3.0 → 7.0.2
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 +9 -17
- package/build/editor.bundle.js +11601 -10129
- package/build/esm/editor/common/log-socket.js +1 -0
- package/build/esm/editor/common/templates.js +90 -90
- package/build/esm/editor/components/api-preview.js +2 -0
- package/build/esm/editor/components/editor.js +2 -0
- package/build/esm/editor/components/file-browser.js +1 -0
- package/build/esm/editor/components/file-editor-toolbar.js +2 -0
- package/build/esm/editor/components/file-editor.js +2 -0
- package/build/esm/editor/components/filter-query.js +1 -0
- package/build/esm/editor/components/highlight-text-area.js +2 -0
- package/build/esm/editor/components/log-viewer.js +2 -0
- package/build/esm/editor/components/new-file.js +2 -0
- package/build/esm/editor/components/scroll-query.js +1 -0
- package/build/esm/editor/components/start-page.js +2 -0
- package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/read.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/fs/write.api.js +2 -1
- package/build/esm/editor/http/admin/editor/api/server/restart.api.js +2 -1
- package/build/esm/editor/http/admin/editor/editor.js +2 -1
- package/build/esm/editor/http/admin/editor/index.api.js +1 -0
- package/build/esm/src/bin/types.js +10 -5
- package/build/esm/src/cluster.js +1 -1
- package/build/esm/src/common/arguments.d.ts +1 -1
- package/build/esm/src/common/arguments.js +28 -14
- package/build/esm/src/common/assets.d.ts +1 -1
- package/build/esm/src/common/assets.js +34 -13
- package/build/esm/src/common/esbuild.d.ts +4 -1
- package/build/esm/src/common/esbuild.js +31 -26
- package/build/esm/src/common/exit.js +4 -4
- package/build/esm/src/common/help.d.ts +1 -1
- package/build/esm/src/common/help.js +0 -1
- package/build/esm/src/common/jsx.d.ts +2 -3
- package/build/esm/src/common/jsx.js +70 -75
- package/build/esm/src/common/paths.d.ts +0 -1
- package/build/esm/src/common/paths.js +3 -3
- package/build/esm/src/common/watch.d.ts +0 -1
- package/build/esm/src/common/watch.js +1 -1
- package/build/esm/src/inflate/inflate-sea.js +35 -24
- package/build/esm/src/inflate/inflate.js +4 -4
- package/build/esm/src/inflate/setup-auth.js +1 -1
- package/build/esm/src/inflate/setup-cors.js +1 -1
- package/build/esm/src/inflate/setup-db.js +2 -2
- package/build/esm/src/inflate/setup-error.js +1 -1
- package/build/esm/src/inflate/setup-http.js +16 -16
- package/build/esm/src/inflate/setup-log.js +1 -1
- package/build/esm/src/inflate/setup-middleware.js +1 -1
- package/build/esm/src/inflate/setup-server-config.js +1 -1
- package/build/esm/src/inflate/setup-ws.js +1 -1
- package/build/esm/src/inflate/setup.doc.d.ts +2 -2
- package/build/esm/src/inflate/setup.doc.js +23 -2
- package/build/esm/src/inflate/utils/sea-utils.js +2 -2
- package/build/esm/src/lib.d.ts +10 -1
- package/build/esm/src/lib.js +16 -1
- package/build/esm/src/main.js +1 -1
- package/build/esm/src/services/app.js +3 -4
- package/build/esm/src/services/migrations.js +2 -2
- package/build/esm/src/services/utils/jwt.d.ts +2 -0
- package/build/esm/src/services/utils/jwt.js +23 -0
- package/build/esm/src/services/utils/middleware.d.ts +9 -0
- package/build/esm/src/services/utils/middleware.js +9 -0
- package/build/esm/src/services/utils/server-interface.js +33 -4
- package/build/esm/src/types.d.ts +50 -83
- package/build/lib.cjs +15684 -15612
- package/editor/common/log-socket.tsx +2 -0
- package/editor/common/templates.ts +12 -12
- package/editor/components/api-preview.tsx +2 -0
- package/editor/components/editor.tsx +2 -0
- package/editor/components/file-browser.tsx +3 -0
- package/editor/components/file-editor-toolbar.tsx +3 -0
- package/editor/components/file-editor.tsx +3 -0
- package/editor/components/filter-query.tsx +4 -0
- package/editor/components/highlight-text-area.tsx +3 -0
- package/editor/components/log-viewer.tsx +3 -0
- package/editor/components/new-file.tsx +3 -0
- package/editor/components/scroll-query.tsx +3 -0
- package/editor/components/start-page.tsx +3 -0
- package/editor/http/admin/editor/api/fs/delete.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/read.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/rename.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/scan.api.tsx +2 -2
- package/editor/http/admin/editor/api/fs/write.api.tsx +2 -2
- package/editor/http/admin/editor/api/server/restart.api.tsx +2 -2
- package/editor/http/admin/editor/editor.tsx +3 -1
- package/editor/http/admin/editor/index.api.tsx +3 -0
- package/package.json +6 -8
- package/sea/basic-compile.base64.sh +1 -1
- package/sea/basic-compile.sh +1 -1
- package/sea/install-nodejs.sh +1 -1
- package/sea/node.version.tag +1 -1
- package/src/bin/types.ts +7 -2
- package/src/cluster.ts +1 -1
- package/src/common/arguments.ts +27 -10
- package/src/common/assets.ts +32 -12
- package/src/common/esbuild.ts +11 -3
- package/src/common/exit.ts +3 -3
- package/src/common/help.ts +0 -1
- package/src/common/jsx.ts +50 -35
- package/src/common/paths.ts +2 -2
- package/src/common/watch.ts +1 -1
- package/src/inflate/inflate-sea.ts +35 -24
- package/src/inflate/inflate.ts +4 -4
- package/src/inflate/setup-auth.ts +1 -1
- package/src/inflate/setup-cors.ts +1 -1
- package/src/inflate/setup-db.ts +2 -2
- package/src/inflate/setup-error.ts +1 -1
- package/src/inflate/setup-http.ts +16 -16
- package/src/inflate/setup-log.ts +1 -1
- package/src/inflate/setup-middleware.ts +1 -1
- package/src/inflate/setup-server-config.ts +1 -1
- package/src/inflate/setup-ws.ts +1 -1
- package/src/inflate/setup.doc.ts +27 -3
- package/src/inflate/utils/sea-utils.ts +2 -2
- package/src/lib.ts +17 -2
- package/src/main.ts +1 -1
- package/src/services/app.ts +4 -4
- package/src/services/migrations.ts +2 -2
- package/src/services/utils/jwt.ts +25 -0
- package/src/services/utils/middleware.ts +10 -0
- package/src/services/utils/server-interface.ts +37 -7
- package/src/types.ts +56 -53
- package/.eslintrc +0 -15
- package/build/esm/src/services/globals.d.ts +0 -3
- package/build/esm/src/services/globals.js +0 -182
- package/build/jsx.dom.js +0 -1587
- package/build/postject.base64.cjs +0 -1
- package/sea/types.json +0 -1
- package/src/types/@esbuild.d.ts +0 -1
- package/src/types/@miqro/core.d.ts +0 -2
- package/src/types/@miqro/jsx.d.ts +0 -2
- package/src/types/@miqro/parser.d.ts +0 -2
- package/src/types/@miqro/query.d.ts +0 -2
- package/src/types/@miqro/request.d.ts +0 -2
- package/src/types/@miqro/test.d.ts +0 -2
- package/src/types/@miqro.d.ts +0 -1
- package/src/types/@types.d.ts +0 -1
- package/src/types/browser.globals.d.ts +0 -1
- package/src/types/cookie.d.ts +0 -2
- package/src/types/globals.d.ts +0 -2
- package/src/types/jose.d.ts +0 -2
- package/src/types/jsx.globals.d.ts +0 -38
- package/src/types/miqro.d.ts +0 -228
- package/src/types/postject.d.ts +0 -1
- package/src/types/server.globals.d.ts +0 -47
- package/tsconfig.json +0 -35
- /package/src/services/{globals.ts → globals.ts.ignore} +0 -0
package/src/common/esbuild.ts
CHANGED
|
@@ -18,7 +18,7 @@ export async function initESBuild(logger: Logger) {
|
|
|
18
18
|
return initAsset(logger, getESBuildBinaryPath(), esbuildBinaryBuffer, true, esbuildBinaryChecksumPromise, false);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const NODEJS_EXTERNAL = [
|
|
21
|
+
/*const NODEJS_EXTERNAL = [
|
|
22
22
|
"node:cluster",
|
|
23
23
|
"node:assert",
|
|
24
24
|
"node:util",
|
|
@@ -44,16 +44,24 @@ const NODEJS_EXTERNAL = [
|
|
|
44
44
|
"browser.globals",
|
|
45
45
|
"sqlite3",
|
|
46
46
|
"pg"
|
|
47
|
+
];*/
|
|
48
|
+
|
|
49
|
+
export const NODEJS_EXTERNAL = [
|
|
50
|
+
"sqlite3",
|
|
51
|
+
"pg",
|
|
52
|
+
"node:*"
|
|
47
53
|
];
|
|
48
54
|
|
|
49
55
|
export async function esBuild(options: {
|
|
50
|
-
platform?: string;
|
|
56
|
+
platform?: string | false;
|
|
51
57
|
entryPoints: [string];
|
|
58
|
+
mainFields?: string;
|
|
52
59
|
bundle?: boolean;
|
|
53
60
|
jsxFactory?: string;
|
|
54
61
|
jsxFragment?: string;
|
|
55
62
|
minify?: boolean;
|
|
56
63
|
outfile?: string;
|
|
64
|
+
external?: string[];
|
|
57
65
|
}, logger?: Logger): Promise<{
|
|
58
66
|
outputFiles: {
|
|
59
67
|
path: string;
|
|
@@ -64,7 +72,7 @@ export async function esBuild(options: {
|
|
|
64
72
|
try {
|
|
65
73
|
//const logger = getLogger(`${SERVER_IDENTIFIER}_ESBUILD`);
|
|
66
74
|
const valid = await validateESBuild(logger);
|
|
67
|
-
const esBuildCMD = `${getESBuildBinaryPath()} "${options.entryPoints[0]}" ${NODEJS_EXTERNAL.map(e => `--external:${e}`).join(" ")} --loader:.js=jsx --jsx-factory=${options.jsxFactory} --jsx-fragment=${options.jsxFragment} ${options.bundle ? " --bundle" : ""}${options.minify ? " --minify" : ""}${options.outfile ? ` --outfile="${options.outfile}"` : ""}${options.platform ? ` --platform=${options.platform}` : ""}`;
|
|
75
|
+
const esBuildCMD = `${getESBuildBinaryPath()} "${options.entryPoints[0]}" ${(options.external ? options.external : NODEJS_EXTERNAL).map(e => `--external:${e}`).join(" ")} --loader:.js=jsx --jsx-factory=${options.jsxFactory} --jsx-fragment=${options.jsxFragment} ${options.bundle ? " --bundle" : ""}${options.minify ? " --minify" : ""}${options.outfile ? ` --outfile="${options.outfile}"` : ""}${options.platform ? ` --platform=${options.platform}` : ""}${options.mainFields ? ` --main-fields=${options.mainFields}` : ""}`;
|
|
68
76
|
logger?.trace(esBuildCMD);
|
|
69
77
|
if (!valid) {
|
|
70
78
|
const err = new Error(`esbuild installation at [${getESBuildBinaryPath()}] tampered`);
|
package/src/common/exit.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, rmdirSync, unlinkSync } from "node:fs";
|
|
2
2
|
//import { notifiyServerStop, notifiyServerUnLoad } from "../services/server.js";
|
|
3
|
-
import { getESBuildBinaryPath
|
|
3
|
+
import { getESBuildBinaryPath/*, getJSXJSPath*/, JSX_TMP_DIR } from "./paths.js";
|
|
4
4
|
import { CLEAR_JSX_CACHE } from "./constants.js";
|
|
5
5
|
import { resolve } from "node:path";
|
|
6
6
|
import { EXIT_CODES } from "./constants.js";
|
|
@@ -12,10 +12,10 @@ function cleanJSX(app: Miqro) {
|
|
|
12
12
|
unlinkSync(getESBuildBinaryPath());
|
|
13
13
|
}
|
|
14
14
|
if (CLEAR_JSX_CACHE) {
|
|
15
|
-
app.logger?.trace("trying to clean up jsx.js installation at [%s]", getJSXJSPath());
|
|
15
|
+
/*app.logger?.trace("trying to clean up jsx.js installation at [%s]", getJSXJSPath());
|
|
16
16
|
if (existsSync(getJSXJSPath())) {
|
|
17
17
|
unlinkSync(getJSXJSPath());
|
|
18
|
-
}
|
|
18
|
+
}*/
|
|
19
19
|
const buildParendDir = resolve(JSX_TMP_DIR, String(process.pid));
|
|
20
20
|
app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
|
|
21
21
|
const buildDir = resolve(buildParendDir, "build");
|
package/src/common/help.ts
CHANGED
|
@@ -33,7 +33,6 @@ export const help = `
|
|
|
33
33
|
--compile\n\tinflates the application and tries to create a NODE SEA binary.
|
|
34
34
|
--inflate-sea\n\tinflates the application with sea compilation scripts.
|
|
35
35
|
--install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.
|
|
36
|
-
--install-types\n\tcreates and updates the .types/ folder use together with --install-tsconfig.
|
|
37
36
|
--install-miqrojson\n\tcreates a default miqro.json file.
|
|
38
37
|
--disable-miqrojson\n\tdisables the load of miqro.json file.
|
|
39
38
|
--log-file\n\toverrides the default log file from LOG_FILE.
|
package/src/common/jsx.ts
CHANGED
|
@@ -8,9 +8,9 @@ import { APIRouteSchema, SessionHandlerOptionsSchema } from "@miqro/core";
|
|
|
8
8
|
import { cwd } from "node:process";
|
|
9
9
|
|
|
10
10
|
import { esBuild } from "./esbuild.js";
|
|
11
|
-
import { assertGlobalTampered, browserJSXGlobals } from "../services/globals.js";
|
|
11
|
+
// import { assertGlobalTampered, browserJSXGlobals } from "../services/globals.js";
|
|
12
12
|
import { APIOptions, ServerConfig, WSConfig, AuthConfig, DBConfig, LogConfig, MiddlewareConfig, ErrorConfig, DocConfig } from "../types.js";
|
|
13
|
-
import {
|
|
13
|
+
import { JSX_TMP_DIR } from "./paths.js";
|
|
14
14
|
import { CLEAR_JSX_CACHE } from "./constants.js";
|
|
15
15
|
import { getAsset, initAsset, validateAsset } from "./assets.js";
|
|
16
16
|
import { calculateChecksumFromBuffer } from "./checksum.js";
|
|
@@ -21,7 +21,7 @@ import { mkdirASync, rmdirASync, unlinkASync, writeFileASync } from "./fs.js";
|
|
|
21
21
|
let jsxJSBuffer: null | Buffer = null; // Buffer.from(getAsset("jsx.dom.js"));
|
|
22
22
|
let jsxJSBufferChecksumPromise: null | Promise<string> = null; // calculateChecksumFromBuffer(jsxJSBuffer);
|
|
23
23
|
|
|
24
|
-
export async function initJSXJS(logger: Logger) {
|
|
24
|
+
/*export async function initJSXJS(logger: Logger) {
|
|
25
25
|
jsxJSBuffer = jsxJSBuffer ? jsxJSBuffer : Buffer.from(getAsset("jsx.dom.js"));
|
|
26
26
|
jsxJSBufferChecksumPromise = jsxJSBufferChecksumPromise ? jsxJSBufferChecksumPromise : calculateChecksumFromBuffer(jsxJSBuffer);
|
|
27
27
|
return initAsset(logger, getJSXJSPath(), jsxJSBuffer, true, jsxJSBufferChecksumPromise, false);
|
|
@@ -33,7 +33,7 @@ export async function validateJSXJS(logger: Logger) {
|
|
|
33
33
|
throw new Error("error calculating checksum");
|
|
34
34
|
}
|
|
35
35
|
return validateAsset(logger, getJSXJSPath(), checksum);
|
|
36
|
-
}
|
|
36
|
+
}*/
|
|
37
37
|
|
|
38
38
|
export interface Dict<T> {
|
|
39
39
|
[key: string]: T | Dict<T>;
|
|
@@ -47,60 +47,74 @@ export interface InflateError {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export interface InflateOptions {
|
|
50
|
-
embemedJSX: boolean;
|
|
50
|
+
// embemedJSX: boolean;
|
|
51
51
|
minify: boolean;
|
|
52
52
|
useExport: boolean;
|
|
53
53
|
platform?: string;
|
|
54
|
+
mainFields?: string;
|
|
55
|
+
external?: string[];
|
|
54
56
|
logger?: Logger | Console;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
const DEFAULT_ESOPTION = {
|
|
58
60
|
platform: "neutral",
|
|
61
|
+
mainFields: "module,main",
|
|
62
|
+
// platform: "node",
|
|
59
63
|
bundle: true,
|
|
60
64
|
jsxFactory: "JSX.createElement",
|
|
61
65
|
jsxFragment: "JSX.Fragment"
|
|
62
66
|
};
|
|
63
67
|
|
|
68
|
+
function JSXTemplate(inFile: string/*, jsxPath: string | false = false*/, useExport = true): string {
|
|
69
|
+
// const PRE = ``;
|
|
70
|
+
// return `${jsxPath ? PRE : ""}\n${useExport ? `export * from "${inFile}";import * as lib from "${inFile}";export default lib.default;` : `import * as lib from "${inFile}"`}`;
|
|
71
|
+
return `${useExport ? `export * from "${inFile}";import * as lib from "${inFile}";export default lib.default;` : `import * as lib from "${inFile}"`}`;
|
|
72
|
+
}
|
|
73
|
+
|
|
64
74
|
export async function inflateJSX(inFile: string, options: InflateOptions): Promise<string> {
|
|
65
75
|
const tmpBuildDir = resolve(JSX_TMP_DIR, String(process.pid), "build", Date.now() + "-" + randomUUID());
|
|
66
76
|
const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
|
|
67
|
-
const jsxJSPath = getJSXJSPath();//resolve(tmpBuildDir, "jsx.js");
|
|
77
|
+
//const jsxJSPath = getJSXJSPath();//resolve(tmpBuildDir, "jsx.js");
|
|
68
78
|
const logger = options.logger; //getLogger(`${SERVER_IDENTIFIER}_JSX`);
|
|
69
79
|
|
|
70
80
|
try {
|
|
71
81
|
|
|
72
|
-
if (!options.embemedJSX) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
82
|
+
// if (!options.embemedJSX) {
|
|
83
|
+
await mkdirASync(tmpBuildDir, {
|
|
84
|
+
recursive: true
|
|
85
|
+
});
|
|
86
|
+
await writeFileASync(inFileTmp, JSXTemplate(inFile/*, false*/, options.useExport));
|
|
87
|
+
//await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), false));
|
|
88
|
+
logger?.trace("inflating [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
|
|
89
|
+
const { outputFiles: [{ contents }] } = await esBuild({
|
|
90
|
+
...DEFAULT_ESOPTION,
|
|
91
|
+
entryPoints: [inFileTmp],
|
|
92
|
+
minify: options.minify,
|
|
93
|
+
platform: options.platform !== undefined ? options.platform : DEFAULT_ESOPTION.platform,
|
|
94
|
+
mainFields: options.mainFields !== undefined ? options.mainFields : DEFAULT_ESOPTION.mainFields,
|
|
95
|
+
external: options.external ? options.external : undefined,
|
|
96
|
+
});
|
|
97
|
+
if (CLEAR_JSX_CACHE) {
|
|
98
|
+
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
99
|
+
await unlinkASync(inFileTmp);
|
|
100
|
+
await rmdirASync(tmpBuildDir);
|
|
101
|
+
}
|
|
102
|
+
return contents;
|
|
103
|
+
/*} else {
|
|
92
104
|
await mkdirASync(tmpBuildDir, {
|
|
93
105
|
recursive: true
|
|
94
106
|
});
|
|
95
107
|
//await writeFileASync(jsxJSPath, Buffer.from(getAsset("jsx-dom-bundle")));
|
|
96
|
-
await writeFileASync(inFileTmp, browserJSXGlobals(inFile,
|
|
108
|
+
await writeFileASync(inFileTmp, browserJSXGlobals(inFile, false));
|
|
97
109
|
//await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), relative(tmpBuildDir, jsxJSPath)));
|
|
98
110
|
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)));
|
|
99
111
|
const { outputFiles: [{ contents }] } = await esBuild({
|
|
100
112
|
...DEFAULT_ESOPTION,
|
|
101
113
|
entryPoints: [inFileTmp],
|
|
102
114
|
minify: options.minify,
|
|
103
|
-
platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
|
|
115
|
+
platform: options.platform !== undefined ? options.platform : DEFAULT_ESOPTION.platform,
|
|
116
|
+
mainFields: options.mainFields !== undefined ? options.mainFields : DEFAULT_ESOPTION.mainFields,
|
|
117
|
+
external: options.external ? options.external : undefined
|
|
104
118
|
});
|
|
105
119
|
if (CLEAR_JSX_CACHE) {
|
|
106
120
|
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
@@ -109,11 +123,11 @@ export async function inflateJSX(inFile: string, options: InflateOptions): Promi
|
|
|
109
123
|
await rmdirASync(tmpBuildDir);
|
|
110
124
|
}
|
|
111
125
|
return contents;
|
|
112
|
-
}
|
|
126
|
+
}*/
|
|
113
127
|
} catch (e) {
|
|
114
128
|
logger?.error("error with: " + inFile);
|
|
115
129
|
logger?.error(e);
|
|
116
|
-
if (options.embemedJSX) {
|
|
130
|
+
/*if (options.embemedJSX) {
|
|
117
131
|
if (CLEAR_JSX_CACHE) {
|
|
118
132
|
logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
119
133
|
await unlinkASync(inFileTmp);
|
|
@@ -124,7 +138,7 @@ export async function inflateJSX(inFile: string, options: InflateOptions): Promi
|
|
|
124
138
|
logger?.error("error with: %s", inFileTmp);
|
|
125
139
|
logger?.trace("NOT clearing cache. to change this behaivor set CLEAR_JSX_CACHE to 1", tmpBuildDir);
|
|
126
140
|
}
|
|
127
|
-
}
|
|
141
|
+
}*/
|
|
128
142
|
throw e;
|
|
129
143
|
}
|
|
130
144
|
}
|
|
@@ -479,14 +493,14 @@ export async function importServerConfigModule(inFile: string, logger?: Logger)
|
|
|
479
493
|
|
|
480
494
|
export async function importJSXFile(inFile: string, logger?: Logger | Console): Promise<any> {
|
|
481
495
|
const inflatedCode = await inflateJSX(inFile, {
|
|
482
|
-
embemedJSX: false,
|
|
496
|
+
// embemedJSX: false,
|
|
483
497
|
minify: false,
|
|
484
498
|
useExport: true,
|
|
485
499
|
platform: "node",
|
|
486
500
|
logger
|
|
487
501
|
});
|
|
488
502
|
const tmpBuildDir = resolve(JSX_TMP_DIR, String(process.pid), "import", Date.now() + "-" + randomUUID());
|
|
489
|
-
//const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
|
|
503
|
+
// const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
|
|
490
504
|
const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".cjs");
|
|
491
505
|
//const logger = getLogger(`${SERVER_IDENTIFIER}_JSX`);
|
|
492
506
|
await mkdirASync(tmpBuildDir, {
|
|
@@ -494,11 +508,12 @@ export async function importJSXFile(inFile: string, logger?: Logger | Console):
|
|
|
494
508
|
});
|
|
495
509
|
try {
|
|
496
510
|
await writeFileASync(inFileTmp, inflatedCode);
|
|
497
|
-
assertGlobalTampered();
|
|
511
|
+
// assertGlobalTampered();
|
|
498
512
|
logger?.trace("importing [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
|
|
499
513
|
logger?.debug("importing [%s]", relative(cwd(), inFile));
|
|
500
514
|
const module = await import(resolve(inFileTmp));
|
|
501
|
-
|
|
515
|
+
// console.dir(module);
|
|
516
|
+
// assertGlobalTampered();
|
|
502
517
|
if (CLEAR_JSX_CACHE) {
|
|
503
518
|
logger?.trace("clearing cache at [%s]. to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
|
|
504
519
|
await unlinkASync(inFileTmp);
|
package/src/common/paths.ts
CHANGED
package/src/common/watch.ts
CHANGED
|
@@ -28,7 +28,7 @@ export async function inflateSeaAssets(logger: Logger, inflateDir: string) {
|
|
|
28
28
|
writeFile(logger, resolve(inflateDir, "sea", "esbuild"), esbuildBinaryBuffer);
|
|
29
29
|
chmodSync(resolve(inflateDir, "sea", "esbuild"), constants.S_IXUSR | constants.S_IRUSR | constants.S_IWUSR);
|
|
30
30
|
}
|
|
31
|
-
writeFile(logger, resolve(inflateDir, "sea", "postject.cjs"), Buffer.from(Buffer.from(getAsset("postject.base64.cjs")).toString(), "base64"));
|
|
31
|
+
// writeFile(logger, resolve(inflateDir, "sea", "postject.cjs"), Buffer.from(Buffer.from(getAsset("postject.base64.cjs")).toString(), "base64"));
|
|
32
32
|
writeFile(logger, resolve(inflateDir, "sea", "config.json"), Buffer.from(getAsset("sea.basic.config.json")));
|
|
33
33
|
writeFile(logger, resolve(inflateDir, "sea", "run.sh"), Buffer.from(getAsset("app.sh")));
|
|
34
34
|
writeFile(logger, resolve(inflateDir, "sea", "node.sh"), Buffer.from(getAsset("node.sh")));
|
|
@@ -47,18 +47,18 @@ export async function inflateAppForSea(logger: Logger, inflateDir: string, servi
|
|
|
47
47
|
writeFile(logger, resolve(inflateDir, "sea", "lib.cjs"), Buffer.from(getAsset("lib.cjs")));
|
|
48
48
|
|
|
49
49
|
const WSLIST = services.filter(service => getWSConfigPath(resolve(cwd(), service))).map(service => {
|
|
50
|
-
return `(await
|
|
50
|
+
return `(await require("../${service}/ws.cjs")).default`;
|
|
51
51
|
}).join(",")
|
|
52
52
|
|
|
53
53
|
const SERVERCONFIGLIST = services.filter(service => getServerConfigPath(resolve(cwd(), service))).map(service => {
|
|
54
|
-
return `(await
|
|
54
|
+
return `(await require("../${service}/server.cjs")).default`;
|
|
55
55
|
}).join(",\n");
|
|
56
56
|
|
|
57
57
|
const DBCONFIGLIST = services.filter(service => getDBConfigPath(resolve(cwd(), service))).map(service => {
|
|
58
58
|
return `new Promise(async (resolve, reject) => {
|
|
59
59
|
try {
|
|
60
|
-
const db = await dbManager.setupDB((await
|
|
61
|
-
await (await
|
|
60
|
+
const db = await dbManager.setupDB((await require("../${service}/db.cjs")).default);
|
|
61
|
+
await (await require("./${service}/migration-up.cjs")).runMigrations(db);
|
|
62
62
|
resolve();
|
|
63
63
|
} catch(e) {
|
|
64
64
|
reject(e);
|
|
@@ -69,7 +69,7 @@ export async function inflateAppForSea(logger: Logger, inflateDir: string, servi
|
|
|
69
69
|
|
|
70
70
|
writeFile(logger, join(inflateDir, "sea", "package.json"), `{ "type": "module", "private": true }`);
|
|
71
71
|
|
|
72
|
-
writeFile(logger, join(inflateDir, "sea", "app.cjs"), `const { createServerInterface, ServerRequestHandler, WebSocketManager,
|
|
72
|
+
writeFile(logger, join(inflateDir, "sea", "app.cjs"), `const { createServerInterface, ServerRequestHandler, WebSocketManager, DBManager, App, LoggerHandler, LogProvider, LocalCache, ClusterCache } = require("./lib.cjs");
|
|
73
73
|
|
|
74
74
|
async function main() {
|
|
75
75
|
const PORT = "${PORT}";
|
|
@@ -78,7 +78,6 @@ async function main() {
|
|
|
78
78
|
const cache = new ClusterCache();
|
|
79
79
|
const webSocketManager = new WebSocketManager();
|
|
80
80
|
const dbManager = new DBManager();
|
|
81
|
-
await initGlobals();
|
|
82
81
|
const serverInterface = createServerInterface({
|
|
83
82
|
cache,
|
|
84
83
|
localCache,
|
|
@@ -98,7 +97,7 @@ async function main() {
|
|
|
98
97
|
${SERVERCONFIGLIST ? `\n await Promise.all([${SERVERCONFIGLIST}].filter(config=>config.preload).map(config=>config.preload(serverInterface)));\n` : ""}
|
|
99
98
|
app.use(ServerRequestHandler(serverInterface));
|
|
100
99
|
app.use(LoggerHandler());
|
|
101
|
-
${services.map(service => `app.use(await (await
|
|
100
|
+
${services.map(service => `app.use(await (await require("./${join(service, "router.cjs")}")).setupRouter());`).join("\n")}
|
|
102
101
|
${SERVERCONFIGLIST ? `\n await Promise.all([${SERVERCONFIGLIST}].filter(config=>config.load).map(config=>config.load(serverInterface)));\n` : ""}
|
|
103
102
|
|
|
104
103
|
await app.listen(PORT);
|
|
@@ -129,20 +128,20 @@ export async function inflateServiceForSea(logger: Logger, inflateDir: string, s
|
|
|
129
128
|
const migrationsFolderPath = getMigrationsPath(servicePath);
|
|
130
129
|
|
|
131
130
|
const serviceMigrations: string[] = migrationsFolderPath ? migration.getSortedMigrations(migrationsFolderPath) : [];
|
|
132
|
-
writeFile(logger, join(inflateDir, "sea", service, "router.
|
|
133
|
-
|
|
131
|
+
writeFile(logger, join(inflateDir, "sea", service, "router.cjs"), `const { appendAPIModule, Router, middleware } = require("./../lib.cjs");\n
|
|
132
|
+
async function setupRouter() {
|
|
134
133
|
const router = new Router();
|
|
135
134
|
${getErrorConfigPath(servicePath) ? `
|
|
136
|
-
const errorConfig = (await
|
|
135
|
+
const errorConfig = (await require("../../${service}/catch.cjs")).default;
|
|
137
136
|
if(errorConfig && errorConfig.catch) {
|
|
138
137
|
for(const m of errorConfig.catch) {
|
|
139
138
|
router.catch(m);
|
|
140
139
|
}
|
|
141
140
|
}` : ""}
|
|
142
|
-
${getCORSConfigPath(servicePath) ? ` router.use(
|
|
143
|
-
${getAuthConfigPath(servicePath) ? ` router.use(
|
|
141
|
+
${getCORSConfigPath(servicePath) ? ` router.use(middleware.cors((await require("../../${service}/cors.cjs")).default));` : ""}
|
|
142
|
+
${getAuthConfigPath(servicePath) ? ` router.use(middleware.session((await require("../../${service}/auth.cjs")).default));` : ""}
|
|
144
143
|
${getMiddlewareConfigPath(servicePath) ? `
|
|
145
|
-
const middlewareConfig = (await
|
|
144
|
+
const middlewareConfig = (await require("../../${service}/middleware.cjs")).default;
|
|
146
145
|
if(middlewareConfig && middlewareConfig.middleware) {
|
|
147
146
|
for(const m of middlewareConfig.middleware) {
|
|
148
147
|
router.use(m);
|
|
@@ -156,13 +155,13 @@ ${Object.keys(serviceRouteFileMap)
|
|
|
156
155
|
if (rPath) {
|
|
157
156
|
const rPathExt = extname(rPath);
|
|
158
157
|
const apiInflatedPath = join("..", "..", rPath.substring(0, rPath.length - rPathExt.length) + ".cjs");
|
|
159
|
-
return ` await appendAPIModule(router, "../../${service}/http", "./${apiInflatedPath}", (await
|
|
158
|
+
return ` await appendAPIModule(router, "../../${service}/http", "./${apiInflatedPath}", (await require("./${apiInflatedPath}")).default);`;
|
|
160
159
|
} else {
|
|
161
160
|
return "";
|
|
162
161
|
}
|
|
163
162
|
}).filter(l => l)[0])
|
|
164
163
|
.join("\n")}
|
|
165
|
-
router.use(await (await
|
|
164
|
+
router.use(await (await require("./static-router.cjs")).setupRouter())
|
|
166
165
|
|
|
167
166
|
${getMiddlewareConfigPath(servicePath) ? `
|
|
168
167
|
if(middlewareConfig && middlewareConfig.post) {
|
|
@@ -172,32 +171,41 @@ ${getMiddlewareConfigPath(servicePath) ? `
|
|
|
172
171
|
}` : ""}
|
|
173
172
|
|
|
174
173
|
return router;
|
|
174
|
+
}
|
|
175
|
+
module.exports = {
|
|
176
|
+
setupRouter
|
|
175
177
|
}`);
|
|
176
178
|
|
|
177
|
-
writeFile(logger, join(inflateDir, "sea", service, "migration-up.
|
|
178
|
-
|
|
179
|
+
writeFile(logger, join(inflateDir, "sea", service, "migration-up.cjs"), `const { migration } = require("./../lib.cjs");\n
|
|
180
|
+
async function runMigrations(db) {
|
|
179
181
|
await migration.init(db);
|
|
180
182
|
${serviceMigrations.map(file => {
|
|
181
183
|
const name = `${file.substring(0, file.length - extname(file).length)}`;
|
|
182
|
-
return ` await migration.up.module(db, "${file}", (await
|
|
184
|
+
return ` await migration.up.module(db, "${file}", (await require("../../${service}/migration/${name}.cjs")).default)`;
|
|
183
185
|
}).join("\n")}
|
|
186
|
+
}
|
|
187
|
+
module.exports = {
|
|
188
|
+
runMigrations
|
|
184
189
|
}`);
|
|
185
190
|
|
|
186
|
-
writeFile(logger, join(inflateDir, "sea", service, "migration-down.
|
|
187
|
-
|
|
191
|
+
writeFile(logger, join(inflateDir, "sea", service, "migration-down.cjs"), `const { migration } = require("./../lib.cjs");\n
|
|
192
|
+
async function runMigrations(db) {
|
|
188
193
|
await migration.init(db);
|
|
189
194
|
${serviceMigrations.reverse().map(file => {
|
|
190
195
|
const name = `${file.substring(0, file.length - extname(file).length)}`;
|
|
191
|
-
return ` await migration.down.module(db, "${file}", (await
|
|
196
|
+
return ` await migration.down.module(db, "${file}", (await require("../../${service}/migration/${name}.cjs")).default)`;
|
|
192
197
|
}).join("\n")}
|
|
198
|
+
}
|
|
199
|
+
module.exports = {
|
|
200
|
+
runMigrations
|
|
193
201
|
}`);
|
|
194
202
|
|
|
195
203
|
const staticFiles = Object.keys(serviceStaticFileMap);
|
|
196
204
|
/*if (staticFiles.length !== 0) {
|
|
197
205
|
writeFile(logger, join(inflateDir, "sea", service, "static.base64.json"), JSON.stringify(serviceStaticFileMap));
|
|
198
206
|
}*/
|
|
199
|
-
writeFile(logger, join(inflateDir, "sea", service, "static-router.
|
|
200
|
-
|
|
207
|
+
writeFile(logger, join(inflateDir, "sea", service, "static-router.cjs"), `const { appendAPIModule, Router } = require("./../lib.cjs");\n
|
|
208
|
+
async function setupRouter() {
|
|
201
209
|
const router = new Router();
|
|
202
210
|
${staticFiles.length === 0 ? "" : `
|
|
203
211
|
${staticFiles.map((filePath) => {
|
|
@@ -213,6 +221,9 @@ ${staticFiles.map((filePath) => {
|
|
|
213
221
|
}).join("\n")}
|
|
214
222
|
`}
|
|
215
223
|
return router;
|
|
224
|
+
}
|
|
225
|
+
module.exports = {
|
|
226
|
+
setupRouter
|
|
216
227
|
}`);
|
|
217
228
|
|
|
218
229
|
}
|
package/src/inflate/inflate.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Logger, Router } from "@miqro/core";
|
|
|
3
3
|
import { RouteFileMap, setupHTTPRouter, StaticFileMap } from "./setup-http.js";
|
|
4
4
|
//import { WSMapConfig } from "./utils/websocketmanager.js";
|
|
5
5
|
//import { ServerConfigMap, setupServerConfig } from "./setup-server-config.js";
|
|
6
|
-
import { assertGlobalTampered } from "../services/globals.js";
|
|
6
|
+
// import { assertGlobalTampered } from "../services/globals.js";
|
|
7
7
|
import { getServicePath } from "../common/paths.js";
|
|
8
8
|
import { inflateWSConfig } from "./setup-ws.js";
|
|
9
9
|
import { inflateAppForSea, inflateServiceForSea } from "./inflate-sea.js";
|
|
@@ -35,7 +35,7 @@ export async function inflateApp({ inflateParallel, serverInterface, logger, hot
|
|
|
35
35
|
const logConfigMap: LogConfigMap = {};
|
|
36
36
|
//const serverConfigMap: ServerConfigMap = {};
|
|
37
37
|
|
|
38
|
-
router.use(assertGlobalTampered);
|
|
38
|
+
// router.use(assertGlobalTampered);
|
|
39
39
|
|
|
40
40
|
/*if (editor) {
|
|
41
41
|
logger.info("setting up editor on %s", BASEEDITOR_PATH);
|
|
@@ -76,7 +76,7 @@ export async function inflateApp({ inflateParallel, serverInterface, logger, hot
|
|
|
76
76
|
...serviceRouteFileMap
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
await setupDoc(logger, servicePath, service, router, routeFileMap, inflateDir, errors);
|
|
79
|
+
await setupDoc(logger, servicePath, service, router, routeFileMap, serviceStaticFileMap, inflateDir, errors);
|
|
80
80
|
|
|
81
81
|
await inflateWSConfig(logger, servicePath, service, wsConfigList, inflateSea ? inflateDir : undefined, errors);
|
|
82
82
|
|
|
@@ -95,7 +95,7 @@ export async function inflateApp({ inflateParallel, serverInterface, logger, hot
|
|
|
95
95
|
await inflateAppForSea(logger, inflateDir, services, port);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
router.use(assertGlobalTampered);
|
|
98
|
+
// router.use(assertGlobalTampered);
|
|
99
99
|
|
|
100
100
|
return errors.length === 0 ? [router, null, routeFileMap/*, migrations*/, wsConfigList/*, serverConfigMap*/, logConfigMap] : [router, errors, routeFileMap/*, migrations*/, wsConfigList/*, serverConfigMap*/, logConfigMap];
|
|
101
101
|
}
|
|
@@ -21,7 +21,7 @@ export async function setupAUTH(logger: Logger, servicePath: string, service: st
|
|
|
21
21
|
});
|
|
22
22
|
logger.log("writing [%s]", relative(cwd(), inflatePath));
|
|
23
23
|
writeFileSync(inflatePath, await inflateJSX(authPath, {
|
|
24
|
-
embemedJSX: false,
|
|
24
|
+
// embemedJSX: false,
|
|
25
25
|
minify: false,
|
|
26
26
|
useExport: true,
|
|
27
27
|
platform: "node",
|
|
@@ -21,7 +21,7 @@ export async function setupCORS(logger: Logger, servicePath: string, service: st
|
|
|
21
21
|
});
|
|
22
22
|
logger.log("writing [%s]", relative(cwd(), inflatePath));
|
|
23
23
|
writeFileSync(inflatePath, await inflateJSX(corsPath, {
|
|
24
|
-
embemedJSX: false,
|
|
24
|
+
// embemedJSX: false,
|
|
25
25
|
minify: false,
|
|
26
26
|
useExport: true,
|
|
27
27
|
platform: "node",
|
package/src/inflate/setup-db.ts
CHANGED
|
@@ -36,7 +36,7 @@ export async function inflateDBConfig(logger: Logger, service: string, dbConfigL
|
|
|
36
36
|
});
|
|
37
37
|
logger.log("writing [%s]", relative(cwd(), inflatePath));
|
|
38
38
|
writeFileSync(inflatePath, await inflateJSX(dbConfigPath, {
|
|
39
|
-
embemedJSX: false,
|
|
39
|
+
// embemedJSX: false,
|
|
40
40
|
minify: false,
|
|
41
41
|
useExport: true,
|
|
42
42
|
platform: "node",
|
|
@@ -91,7 +91,7 @@ export async function inflateDBMigrations(logger: Logger, service: string, dbNam
|
|
|
91
91
|
});
|
|
92
92
|
logger?.log("writing [%s]", relative(cwd(), inflatePath));
|
|
93
93
|
writeFileSync(inflatePath, await inflateJSX(resolve(migrationsFolderPath, migrationName), {
|
|
94
|
-
embemedJSX: false,
|
|
94
|
+
// embemedJSX: false,
|
|
95
95
|
minify: false,
|
|
96
96
|
useExport: true,
|
|
97
97
|
platform: "node",
|
|
@@ -24,7 +24,7 @@ export async function setupError(logger: Logger, servicePath: string, service: s
|
|
|
24
24
|
});
|
|
25
25
|
logger.log("writing [%s]", relative(cwd(), inflatePath));
|
|
26
26
|
writeFileSync(inflatePath, await inflateJSX(errorPath, {
|
|
27
|
-
embemedJSX: false,
|
|
27
|
+
// embemedJSX: false,
|
|
28
28
|
minify: false,
|
|
29
29
|
useExport: true,
|
|
30
30
|
platform: "node",
|
|
@@ -8,7 +8,7 @@ import { createNodeRuntime } from "@miqro/jsx-node";
|
|
|
8
8
|
import { getHotReloadScript } from "../services/hot-reload.js";
|
|
9
9
|
import { RuntimeURL } from "@miqro/jsx";
|
|
10
10
|
import { cwd } from "node:process";
|
|
11
|
-
import { assertGlobalTampered } from "../services/globals.js";
|
|
11
|
+
// import { assertGlobalTampered } from "../services/globals.js";
|
|
12
12
|
import { getHTTPRouterPath, getStaticFilesPath } from "../common/paths.js";
|
|
13
13
|
import { setupCORS } from "./setup-cors.js";
|
|
14
14
|
import { setupAUTH } from "./setup-auth.js";
|
|
@@ -128,7 +128,7 @@ async function createStaticRoute(service: string, logger: Logger, router: Router
|
|
|
128
128
|
|
|
129
129
|
|
|
130
130
|
|
|
131
|
-
router.use(assertGlobalTampered);
|
|
131
|
+
// router.use(assertGlobalTampered);
|
|
132
132
|
router.get(path, async function (_req, res) {
|
|
133
133
|
await new Promise<void>((resolve, reject) => {
|
|
134
134
|
try {
|
|
@@ -191,7 +191,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
191
191
|
const maxParallel = inflateParallel ? inflateParallel : 1;
|
|
192
192
|
server.logger.debug("loading http directory with parallel [%s]", maxParallel);
|
|
193
193
|
let tR = [];
|
|
194
|
-
router.use(assertGlobalTampered);
|
|
194
|
+
// router.use(assertGlobalTampered);
|
|
195
195
|
const files = scanFiles(dir);
|
|
196
196
|
for (const file of files) {
|
|
197
197
|
tR.push(new Promise<void>(async (resolve) => {
|
|
@@ -222,7 +222,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
222
222
|
};
|
|
223
223
|
|
|
224
224
|
const inflatedCode = inflateDir ? await inflateJSX(file.filePath, {
|
|
225
|
-
embemedJSX: false,
|
|
225
|
+
// embemedJSX: false,
|
|
226
226
|
minify: false,
|
|
227
227
|
useExport: true,
|
|
228
228
|
platform: "node",
|
|
@@ -252,7 +252,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
|
|
255
|
-
router.use(assertGlobalTampered);
|
|
255
|
+
// router.use(assertGlobalTampered);
|
|
256
256
|
router.use(module.handler, r.path, r.method as any, r.options);
|
|
257
257
|
}
|
|
258
258
|
return resolve();
|
|
@@ -307,7 +307,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
router.use(assertGlobalTampered);
|
|
310
|
+
// router.use(assertGlobalTampered);
|
|
311
311
|
router.use(async function (req: Request, res: Response) {
|
|
312
312
|
|
|
313
313
|
const JSON = await getJSON(req, res, newURL(req.path), module.apiOptions?.basePath, module.default);
|
|
@@ -376,7 +376,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
router.use(assertGlobalTampered);
|
|
379
|
+
// router.use(assertGlobalTampered);
|
|
380
380
|
router.use(async function (req: Request, res: Response) {
|
|
381
381
|
const toRender = typeof module.default === "function" ? module.default(req, res) : module.default;
|
|
382
382
|
const HTML = await getHTML(hotreload, req, res, newURL(req.path), module.apiOptions?.basePath, await toRender);
|
|
@@ -398,9 +398,9 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
398
398
|
// allow fall-through when extension is .js and .ts because is a static route without embemedJSX
|
|
399
399
|
if (file.ext !== ".js" && file.ext !== ".ts") {
|
|
400
400
|
const code = await inflateJSX(file.filePath, {
|
|
401
|
-
embemedJSX: true,
|
|
401
|
+
// embemedJSX: true,
|
|
402
402
|
minify: file.subExt === ".min" ? true : false,
|
|
403
|
-
useExport:
|
|
403
|
+
useExport: true,
|
|
404
404
|
logger
|
|
405
405
|
});
|
|
406
406
|
const contentType = CONTENT_TYPE_MAP[".js"];
|
|
@@ -438,7 +438,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
router.use(assertGlobalTampered);
|
|
441
|
+
// router.use(assertGlobalTampered);
|
|
442
442
|
router.get(path, async function (req, res) {
|
|
443
443
|
return res.asyncEnd({
|
|
444
444
|
status: 200,
|
|
@@ -489,7 +489,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
|
|
492
|
-
router.use(assertGlobalTampered);
|
|
492
|
+
// router.use(assertGlobalTampered);
|
|
493
493
|
router.get(path, async function (_req, res) {
|
|
494
494
|
res.asyncEnd({
|
|
495
495
|
status: 200,
|
|
@@ -513,9 +513,9 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
513
513
|
case ".bundle":
|
|
514
514
|
case ".min": {
|
|
515
515
|
const code = await inflateJSX(file.filePath, {
|
|
516
|
-
embemedJSX: false,
|
|
516
|
+
// embemedJSX: false,
|
|
517
517
|
minify: file.subExt === ".min" ? true : false,
|
|
518
|
-
useExport:
|
|
518
|
+
useExport: true,
|
|
519
519
|
logger
|
|
520
520
|
});
|
|
521
521
|
const contentType = CONTENT_TYPE_MAP[".js"];
|
|
@@ -550,7 +550,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
router.use(assertGlobalTampered);
|
|
553
|
+
// router.use(assertGlobalTampered);
|
|
554
554
|
router.get(path, async function (_req, res) {
|
|
555
555
|
res.asyncEnd({
|
|
556
556
|
status: 200,
|
|
@@ -608,7 +608,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
-
router.use(assertGlobalTampered);
|
|
611
|
+
// router.use(assertGlobalTampered);
|
|
612
612
|
router.get(path, async function (_req, res) {
|
|
613
613
|
res.asyncEnd({
|
|
614
614
|
status: 200,
|
|
@@ -646,7 +646,7 @@ async function createRouterFromDirectory(server: ServerInterface, hotreload: boo
|
|
|
646
646
|
await Promise.all(tR);
|
|
647
647
|
tR = [];
|
|
648
648
|
}
|
|
649
|
-
router.use(assertGlobalTampered);
|
|
649
|
+
// router.use(assertGlobalTampered);
|
|
650
650
|
return {
|
|
651
651
|
routeFileMap,
|
|
652
652
|
router,
|