intlayer-editor 8.4.3 → 8.4.5
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/client/dist/assets/CodeBlockShiki-BK4mShNB.js +121 -0
- package/client/dist/assets/{bundle-web-C53U69TC.js → bundle-web-MVlAwHWN.js} +1 -1
- package/client/dist/assets/{index-CutqtHet.js → index-C0bpNoe3.js} +15899 -8917
- package/client/dist/index.html +1 -1
- package/package.json +11 -11
- package/server/dist/_virtual/_rolldown/runtime.cjs +29 -1
- package/server/dist/controllers/configuration.controller.cjs +32 -1
- package/server/dist/controllers/configuration.controller.cjs.map +1 -1
- package/server/dist/controllers/configuration.controller.d.ts +1 -1
- package/server/dist/controllers/configuration.controller.mjs +30 -1
- package/server/dist/controllers/configuration.controller.mjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.cjs +108 -1
- package/server/dist/controllers/dictionary.controller.cjs.map +1 -1
- package/server/dist/controllers/dictionary.controller.d.ts +1 -1
- package/server/dist/controllers/dictionary.controller.mjs +105 -1
- package/server/dist/controllers/dictionary.controller.mjs.map +1 -1
- package/server/dist/export.cjs +7 -1
- package/server/dist/export.mjs +4 -1
- package/server/dist/index.cjs +100 -7
- package/server/dist/index.cjs.map +1 -1
- package/server/dist/index.mjs +90 -7
- package/server/dist/index.mjs.map +1 -1
- package/server/dist/routes/config.routes.cjs +20 -1
- package/server/dist/routes/config.routes.cjs.map +1 -1
- package/server/dist/routes/config.routes.mjs +17 -1
- package/server/dist/routes/config.routes.mjs.map +1 -1
- package/server/dist/routes/dictionary.routes.cjs +28 -1
- package/server/dist/routes/dictionary.routes.cjs.map +1 -1
- package/server/dist/routes/dictionary.routes.mjs +25 -1
- package/server/dist/routes/dictionary.routes.mjs.map +1 -1
- package/server/dist/utils/checkPortAvailability.cjs +24 -1
- package/server/dist/utils/checkPortAvailability.cjs.map +1 -1
- package/server/dist/utils/checkPortAvailability.mjs +20 -1
- package/server/dist/utils/checkPortAvailability.mjs.map +1 -1
- package/server/dist/utils/httpStatusCodes.cjs +401 -1
- package/server/dist/utils/httpStatusCodes.cjs.map +1 -1
- package/server/dist/utils/httpStatusCodes.d.ts +407 -2
- package/server/dist/utils/httpStatusCodes.mjs +399 -1
- package/server/dist/utils/httpStatusCodes.mjs.map +1 -1
- package/server/dist/utils/responseData.cjs +33 -1
- package/server/dist/utils/responseData.cjs.map +1 -1
- package/server/dist/utils/responseData.d.ts +87 -2
- package/server/dist/utils/responseData.mjs +31 -1
- package/server/dist/utils/responseData.mjs.map +1 -1
- package/client/dist/assets/CodeBlockShiki-B3siK5AS.js +0 -105
package/server/dist/index.cjs
CHANGED
|
@@ -1,9 +1,102 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_routes_config_routes = require('./routes/config.routes.cjs');
|
|
3
|
+
const require_routes_dictionary_routes = require('./routes/dictionary.routes.cjs');
|
|
4
|
+
const require_utils_checkPortAvailability = require('./utils/checkPortAvailability.cjs');
|
|
5
|
+
let _intlayer_config_node = require("@intlayer/config/node");
|
|
6
|
+
let fastify_intlayer = require("fastify-intlayer");
|
|
7
|
+
let node_fs = require("node:fs");
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
let node_url = require("node:url");
|
|
10
|
+
let _fastify_compress = require("@fastify/compress");
|
|
11
|
+
_fastify_compress = require_runtime.__toESM(_fastify_compress);
|
|
12
|
+
let _fastify_cookie = require("@fastify/cookie");
|
|
13
|
+
_fastify_cookie = require_runtime.__toESM(_fastify_cookie);
|
|
14
|
+
let _fastify_cors = require("@fastify/cors");
|
|
15
|
+
_fastify_cors = require_runtime.__toESM(_fastify_cors);
|
|
16
|
+
let _fastify_formbody = require("@fastify/formbody");
|
|
17
|
+
_fastify_formbody = require_runtime.__toESM(_fastify_formbody);
|
|
18
|
+
let _fastify_helmet = require("@fastify/helmet");
|
|
19
|
+
_fastify_helmet = require_runtime.__toESM(_fastify_helmet);
|
|
20
|
+
let _fastify_static = require("@fastify/static");
|
|
21
|
+
_fastify_static = require_runtime.__toESM(_fastify_static);
|
|
22
|
+
let _intlayer_config_colors = require("@intlayer/config/colors");
|
|
23
|
+
_intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
|
|
24
|
+
let _intlayer_config_env = require("@intlayer/config/env");
|
|
25
|
+
let _intlayer_config_logger = require("@intlayer/config/logger");
|
|
26
|
+
let fastify = require("fastify");
|
|
27
|
+
fastify = require_runtime.__toESM(fastify);
|
|
28
|
+
let mime = require("mime");
|
|
29
|
+
mime = require_runtime.__toESM(mime);
|
|
3
30
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
31
|
+
//#region src/index.ts
|
|
32
|
+
const __dirname$1 = (0, node_path.dirname)((0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
33
|
+
const envFileOptions = {
|
|
34
|
+
env: process.env.NODE_ENV,
|
|
35
|
+
envFile: process.env.ENV_FILE
|
|
36
|
+
};
|
|
37
|
+
const FALLBACK_PORT = 8e3;
|
|
38
|
+
const config = (0, _intlayer_config_node.getConfiguration)(envFileOptions);
|
|
39
|
+
const appLogger = (0, _intlayer_config_logger.getAppLogger)(config);
|
|
40
|
+
const port = config.editor.port ?? FALLBACK_PORT;
|
|
41
|
+
if (!config.editor.enabled) {
|
|
42
|
+
appLogger(`Editor is not enabled. Add ${(0, _intlayer_config_logger.colorize)("editor.enabled", _intlayer_config_colors.BLUE)} to ${(0, _intlayer_config_logger.colorizePath)("intlayer.config.ts")} file to enable it.`, { level: "error" });
|
|
43
|
+
process.exit(0);
|
|
44
|
+
}
|
|
45
|
+
const packageJson = JSON.parse((0, node_fs.readFileSync)((0, node_path.resolve)(__dirname$1, "../../package.json"), "utf8"));
|
|
46
|
+
const app = (0, fastify.default)({ disableRequestLogging: true });
|
|
47
|
+
app.register(fastify_intlayer.intlayer);
|
|
48
|
+
const clientDistPath = (0, node_path.resolve)(__dirname$1, "../../client/dist");
|
|
49
|
+
const corsOptions = {
|
|
50
|
+
origin: "*",
|
|
51
|
+
credentials: true
|
|
52
|
+
};
|
|
53
|
+
const startServer = async (app) => {
|
|
54
|
+
if (!await require_utils_checkPortAvailability.checkPortAvailability(port)) {
|
|
55
|
+
appLogger(`Error: Port ${port} is already in use.`, { level: "error" });
|
|
56
|
+
process.exit(255);
|
|
57
|
+
}
|
|
58
|
+
await app.register(_fastify_helmet.default, {
|
|
59
|
+
contentSecurityPolicy: false,
|
|
60
|
+
global: true
|
|
61
|
+
});
|
|
62
|
+
await app.register(_fastify_cors.default, corsOptions);
|
|
63
|
+
await app.register(_fastify_compress.default);
|
|
64
|
+
await app.register(_fastify_cookie.default);
|
|
65
|
+
await app.register(_fastify_formbody.default);
|
|
66
|
+
await app.register(require_routes_dictionary_routes.dictionaryRouter, { prefix: "/api/dictionary" });
|
|
67
|
+
await app.register(require_routes_config_routes.configurationRouter, { prefix: "/api/config" });
|
|
68
|
+
await app.register(_fastify_static.default, {
|
|
69
|
+
root: clientDistPath,
|
|
70
|
+
wildcard: false
|
|
71
|
+
});
|
|
72
|
+
app.setNotFoundHandler((req, reply) => {
|
|
73
|
+
const requestedPath = (0, node_path.join)(clientDistPath, req.raw.url || "/");
|
|
74
|
+
if ((0, node_fs.existsSync)(requestedPath) && (0, node_fs.lstatSync)(requestedPath).isFile()) {
|
|
75
|
+
const mimeType = mime.default.getType(requestedPath) ?? "application/octet-stream";
|
|
76
|
+
reply.header("Content-Type", mimeType);
|
|
77
|
+
return reply.sendFile(req.raw.url?.split("/").pop() || "index.html");
|
|
78
|
+
} else return reply.sendFile("index.html");
|
|
79
|
+
});
|
|
80
|
+
try {
|
|
81
|
+
await app.listen({
|
|
82
|
+
port,
|
|
83
|
+
host: "0.0.0.0"
|
|
84
|
+
});
|
|
85
|
+
const dotEnvFilePath = (0, _intlayer_config_env.getEnvFilePath)(envFileOptions.env, envFileOptions.envFile);
|
|
86
|
+
console.log(`
|
|
87
|
+
${(0, _intlayer_config_logger.colorize)((0, _intlayer_config_logger.colorize)("INTLAYER", _intlayer_config_colors.BOLD), _intlayer_config_colors.GREY_DARK)} ${(0, _intlayer_config_logger.colorize)(`v${packageJson.version}`, _intlayer_config_colors.GREY_DARK)}
|
|
88
|
+
|
|
89
|
+
Editor running at: ${(0, _intlayer_config_logger.colorizePath)(`http://localhost:${port}`)}
|
|
90
|
+
${(0, _intlayer_config_logger.colorize)("➜", _intlayer_config_colors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === "" ? "-" : (0, _intlayer_config_logger.colorizePath)(config.editor.applicationURL)}
|
|
91
|
+
${(0, _intlayer_config_logger.colorize)("➜", _intlayer_config_colors.GREY_DARK)} Access key: ${config.editor.clientId ?? "-"}
|
|
92
|
+
${(0, _intlayer_config_logger.colorize)("➜", _intlayer_config_colors.GREY_DARK)} Environment: ${dotEnvFilePath ?? "-"}
|
|
93
|
+
`);
|
|
94
|
+
} catch (err) {
|
|
95
|
+
app.log.error(err);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
startServer(app);
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
9
102
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["__dirname","ANSIColors","intlayer","checkPortAvailability","fastifyHelmet","fastifyCors","fastifyCompress","fastifyCookie","fastifyFormbody","dictionaryRouter","configurationRouter","fastifyStatic"],"sources":["../src/index.ts"],"sourcesContent":["import { existsSync, lstatSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport fastifyCompress from '@fastify/compress';\nimport fastifyCookie from '@fastify/cookie';\nimport fastifyCors, { type FastifyCorsOptions } from '@fastify/cors';\nimport fastifyFormbody from '@fastify/formbody';\nimport fastifyHelmet from '@fastify/helmet';\nimport fastifyStatic from '@fastify/static';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport { colorize, colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { configurationRouter } from '@routes/config.routes';\nimport { dictionaryRouter } from '@routes/dictionary.routes';\nimport { checkPortAvailability } from '@utils/checkPortAvailability';\nimport Fastify, { type FastifyInstance } from 'fastify';\nimport { intlayer } from 'fastify-intlayer';\nimport mime from 'mime';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst envFileOptions = {\n env: process.env.NODE_ENV,\n envFile: process.env.ENV_FILE,\n};\n\nconst FALLBACK_PORT = 8000;\nconst config = getConfiguration(envFileOptions);\n\nconst appLogger = getAppLogger(config);\nconst port = config.editor.port ?? FALLBACK_PORT;\n\nif (!config.editor.enabled) {\n appLogger(\n `Editor is not enabled. Add ${colorize('editor.enabled', ANSIColors.BLUE)} to ${colorizePath('intlayer.config.ts')} file to enable it.`,\n {\n level: 'error',\n }\n );\n process.exit(0);\n}\n\n// Load package.json\nconst packageJson = JSON.parse(\n readFileSync(resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst app: FastifyInstance = Fastify({\n disableRequestLogging: true, // Optional: Keep logs clean like the original\n});\n\n// Load internationalization plugin\n// Assuming fastify-intlayer is the Fastify equivalent of express-intlayer\napp.register(intlayer);\n\nconst clientDistPath = resolve(__dirname, '../../client/dist');\n\nconst corsOptions: FastifyCorsOptions = {\n origin: '*',\n credentials: true,\n};\n\nconst startServer = async (app: FastifyInstance) => {\n const isPortAvailable = await checkPortAvailability(port);\n\n if (!isPortAvailable) {\n appLogger(`Error: Port ${port} is already in use.`, {\n level: 'error',\n });\n process.exit(255);\n }\n\n // Security Headers\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n // CORS\n await app.register(fastifyCors, corsOptions);\n\n // Compression\n await app.register(fastifyCompress);\n\n // Cookie Parser\n await app.register(fastifyCookie);\n\n // Parse application/x-www-form-urlencoded\n await app.register(fastifyFormbody);\n\n // Register Routes\n await app.register(dictionaryRouter, { prefix: '/api/dictionary' });\n await app.register(configurationRouter, { prefix: '/api/config' });\n\n // Serve Static Files\n await app.register(fastifyStatic, {\n root: clientDistPath,\n wildcard: false, // We handle the fallback manually to match SPA logic\n });\n\n // For single-page applications, redirect all unmatched routes to index.html\n app.setNotFoundHandler((req, reply) => {\n const requestedPath = join(clientDistPath, req.raw.url || '/');\n\n if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {\n const mimeType =\n mime.getType(requestedPath) ?? 'application/octet-stream';\n reply.header('Content-Type', mimeType);\n return reply.sendFile(req.raw.url?.split('/').pop() || 'index.html');\n } else {\n return reply.sendFile('index.html');\n }\n });\n\n try {\n await app.listen({ port, host: '0.0.0.0' });\n\n const dotEnvFilePath = getEnvFilePath(\n envFileOptions.env,\n envFileOptions.envFile\n );\n\n console.log(`\n ${colorize(colorize('INTLAYER', ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}\n\n Editor running at: ${colorizePath(`http://localhost:${port}`)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === '' ? '-' : colorizePath(config.editor.applicationURL)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? '-'}\n ${colorize('➜', ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? '-'}\n `);\n } catch (err) {\n app.log.error(err);\n process.exit(1);\n }\n};\n\n// Start it up!\nstartServer(app);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["__dirname","ANSIColors","intlayer","checkPortAvailability","fastifyHelmet","fastifyCors","fastifyCompress","fastifyCookie","fastifyFormbody","dictionaryRouter","configurationRouter","fastifyStatic"],"sources":["../src/index.ts"],"sourcesContent":["import { existsSync, lstatSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport fastifyCompress from '@fastify/compress';\nimport fastifyCookie from '@fastify/cookie';\nimport fastifyCors, { type FastifyCorsOptions } from '@fastify/cors';\nimport fastifyFormbody from '@fastify/formbody';\nimport fastifyHelmet from '@fastify/helmet';\nimport fastifyStatic from '@fastify/static';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport { colorize, colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { configurationRouter } from '@routes/config.routes';\nimport { dictionaryRouter } from '@routes/dictionary.routes';\nimport { checkPortAvailability } from '@utils/checkPortAvailability';\nimport Fastify, { type FastifyInstance } from 'fastify';\nimport { intlayer } from 'fastify-intlayer';\nimport mime from 'mime';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst envFileOptions = {\n env: process.env.NODE_ENV,\n envFile: process.env.ENV_FILE,\n};\n\nconst FALLBACK_PORT = 8000;\nconst config = getConfiguration(envFileOptions);\n\nconst appLogger = getAppLogger(config);\nconst port = config.editor.port ?? FALLBACK_PORT;\n\nif (!config.editor.enabled) {\n appLogger(\n `Editor is not enabled. Add ${colorize('editor.enabled', ANSIColors.BLUE)} to ${colorizePath('intlayer.config.ts')} file to enable it.`,\n {\n level: 'error',\n }\n );\n process.exit(0);\n}\n\n// Load package.json\nconst packageJson = JSON.parse(\n readFileSync(resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst app: FastifyInstance = Fastify({\n disableRequestLogging: true, // Optional: Keep logs clean like the original\n});\n\n// Load internationalization plugin\n// Assuming fastify-intlayer is the Fastify equivalent of express-intlayer\napp.register(intlayer);\n\nconst clientDistPath = resolve(__dirname, '../../client/dist');\n\nconst corsOptions: FastifyCorsOptions = {\n origin: '*',\n credentials: true,\n};\n\nconst startServer = async (app: FastifyInstance) => {\n const isPortAvailable = await checkPortAvailability(port);\n\n if (!isPortAvailable) {\n appLogger(`Error: Port ${port} is already in use.`, {\n level: 'error',\n });\n process.exit(255);\n }\n\n // Security Headers\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n // CORS\n await app.register(fastifyCors, corsOptions);\n\n // Compression\n await app.register(fastifyCompress);\n\n // Cookie Parser\n await app.register(fastifyCookie);\n\n // Parse application/x-www-form-urlencoded\n await app.register(fastifyFormbody);\n\n // Register Routes\n await app.register(dictionaryRouter, { prefix: '/api/dictionary' });\n await app.register(configurationRouter, { prefix: '/api/config' });\n\n // Serve Static Files\n await app.register(fastifyStatic, {\n root: clientDistPath,\n wildcard: false, // We handle the fallback manually to match SPA logic\n });\n\n // For single-page applications, redirect all unmatched routes to index.html\n app.setNotFoundHandler((req, reply) => {\n const requestedPath = join(clientDistPath, req.raw.url || '/');\n\n if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {\n const mimeType =\n mime.getType(requestedPath) ?? 'application/octet-stream';\n reply.header('Content-Type', mimeType);\n return reply.sendFile(req.raw.url?.split('/').pop() || 'index.html');\n } else {\n return reply.sendFile('index.html');\n }\n });\n\n try {\n await app.listen({ port, host: '0.0.0.0' });\n\n const dotEnvFilePath = getEnvFilePath(\n envFileOptions.env,\n envFileOptions.envFile\n );\n\n console.log(`\n ${colorize(colorize('INTLAYER', ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}\n\n Editor running at: ${colorizePath(`http://localhost:${port}`)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === '' ? '-' : colorizePath(config.editor.applicationURL)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? '-'}\n ${colorize('➜', ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? '-'}\n `);\n } catch (err) {\n app.log.error(err);\n process.exit(1);\n }\n};\n\n// Start it up!\nstartServer(app);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,+GAAkD,CAAC;AAEzD,MAAM,iBAAiB;CACrB,KAAK,QAAQ,IAAI;CACjB,SAAS,QAAQ,IAAI;CACtB;AAED,MAAM,gBAAgB;AACtB,MAAM,qDAA0B,eAAe;AAE/C,MAAM,sDAAyB,OAAO;AACtC,MAAM,OAAO,OAAO,OAAO,QAAQ;AAEnC,IAAI,CAAC,OAAO,OAAO,SAAS;AAC1B,WACE,oEAAuC,kBAAkBC,wBAAW,KAAK,CAAC,gDAAmB,qBAAqB,CAAC,sBACnH,EACE,OAAO,SACR,CACF;AACD,SAAQ,KAAK,EAAE;;AAIjB,MAAM,cAAc,KAAK,uDACFD,aAAW,qBAAqB,EAAE,OAAO,CAC/D;AAED,MAAM,2BAA+B,EACnC,uBAAuB,MACxB,CAAC;AAIF,IAAI,SAASE,0BAAS;AAEtB,MAAM,wCAAyBF,aAAW,oBAAoB;AAE9D,MAAM,cAAkC;CACtC,QAAQ;CACR,aAAa;CACd;AAED,MAAM,cAAc,OAAO,QAAyB;AAGlD,KAAI,CAFoB,MAAMG,0DAAsB,KAAK,EAEnC;AACpB,YAAU,eAAe,KAAK,sBAAsB,EAClD,OAAO,SACR,CAAC;AACF,UAAQ,KAAK,IAAI;;AAInB,OAAM,IAAI,SAASC,yBAAe;EAChC,uBAAuB;EACvB,QAAQ;EACT,CAAC;AAGF,OAAM,IAAI,SAASC,uBAAa,YAAY;AAG5C,OAAM,IAAI,SAASC,0BAAgB;AAGnC,OAAM,IAAI,SAASC,wBAAc;AAGjC,OAAM,IAAI,SAASC,0BAAgB;AAGnC,OAAM,IAAI,SAASC,mDAAkB,EAAE,QAAQ,mBAAmB,CAAC;AACnE,OAAM,IAAI,SAASC,kDAAqB,EAAE,QAAQ,eAAe,CAAC;AAGlE,OAAM,IAAI,SAASC,yBAAe;EAChC,MAAM;EACN,UAAU;EACX,CAAC;AAGF,KAAI,oBAAoB,KAAK,UAAU;EACrC,MAAM,oCAAqB,gBAAgB,IAAI,IAAI,OAAO,IAAI;AAE9D,8BAAe,cAAc,2BAAc,cAAc,CAAC,QAAQ,EAAE;GAClE,MAAM,WACJ,aAAK,QAAQ,cAAc,IAAI;AACjC,SAAM,OAAO,gBAAgB,SAAS;AACtC,UAAO,MAAM,SAAS,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,KAAK,IAAI,aAAa;QAEpE,QAAO,MAAM,SAAS,aAAa;GAErC;AAEF,KAAI;AACF,QAAM,IAAI,OAAO;GAAE;GAAM,MAAM;GAAW,CAAC;EAE3C,MAAM,0DACJ,eAAe,KACf,eAAe,QAChB;AAED,UAAQ,IAAI;kFACQ,YAAYV,wBAAW,KAAK,EAAEA,wBAAW,UAAU,CAAC,yCAAY,IAAI,YAAY,WAAWA,wBAAW,UAAU,CAAC;;6EAEzF,oBAAoB,OAAO,CAAC;4CAC7D,KAAKA,wBAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,mBAAmB,KAAK,gDAAmB,OAAO,OAAO,eAAe,CAAC;4CAChJ,KAAKA,wBAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,YAAY,IAAI;4CACvF,KAAKA,wBAAW,UAAU,CAAC,8BAA8B,kBAAkB,IAAI;MACxF;UACK,KAAK;AACZ,MAAI,IAAI,MAAM,IAAI;AAClB,UAAQ,KAAK,EAAE;;;AAKnB,YAAY,IAAI"}
|
package/server/dist/index.mjs
CHANGED
|
@@ -1,9 +1,92 @@
|
|
|
1
|
-
import{configurationRouter
|
|
2
|
-
|
|
1
|
+
import { configurationRouter } from "./routes/config.routes.mjs";
|
|
2
|
+
import { dictionaryRouter } from "./routes/dictionary.routes.mjs";
|
|
3
|
+
import { checkPortAvailability } from "./utils/checkPortAvailability.mjs";
|
|
4
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
5
|
+
import { intlayer } from "fastify-intlayer";
|
|
6
|
+
import { existsSync, lstatSync, readFileSync } from "node:fs";
|
|
7
|
+
import { dirname, join, resolve } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import fastifyCompress from "@fastify/compress";
|
|
10
|
+
import fastifyCookie from "@fastify/cookie";
|
|
11
|
+
import fastifyCors from "@fastify/cors";
|
|
12
|
+
import fastifyFormbody from "@fastify/formbody";
|
|
13
|
+
import fastifyHelmet from "@fastify/helmet";
|
|
14
|
+
import fastifyStatic from "@fastify/static";
|
|
15
|
+
import * as ANSIColors from "@intlayer/config/colors";
|
|
16
|
+
import { getEnvFilePath } from "@intlayer/config/env";
|
|
17
|
+
import { colorize, colorizePath, getAppLogger } from "@intlayer/config/logger";
|
|
18
|
+
import Fastify from "fastify";
|
|
19
|
+
import mime from "mime";
|
|
3
20
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
21
|
+
//#region src/index.ts
|
|
22
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const envFileOptions = {
|
|
24
|
+
env: "development",
|
|
25
|
+
envFile: process.env.ENV_FILE
|
|
26
|
+
};
|
|
27
|
+
const FALLBACK_PORT = 8e3;
|
|
28
|
+
const config = getConfiguration(envFileOptions);
|
|
29
|
+
const appLogger = getAppLogger(config);
|
|
30
|
+
const port = config.editor.port ?? FALLBACK_PORT;
|
|
31
|
+
if (!config.editor.enabled) {
|
|
32
|
+
appLogger(`Editor is not enabled. Add ${colorize("editor.enabled", ANSIColors.BLUE)} to ${colorizePath("intlayer.config.ts")} file to enable it.`, { level: "error" });
|
|
33
|
+
process.exit(0);
|
|
34
|
+
}
|
|
35
|
+
const packageJson = JSON.parse(readFileSync(resolve(__dirname, "../../package.json"), "utf8"));
|
|
36
|
+
const app = Fastify({ disableRequestLogging: true });
|
|
37
|
+
app.register(intlayer);
|
|
38
|
+
const clientDistPath = resolve(__dirname, "../../client/dist");
|
|
39
|
+
const corsOptions = {
|
|
40
|
+
origin: "*",
|
|
41
|
+
credentials: true
|
|
42
|
+
};
|
|
43
|
+
const startServer = async (app) => {
|
|
44
|
+
if (!await checkPortAvailability(port)) {
|
|
45
|
+
appLogger(`Error: Port ${port} is already in use.`, { level: "error" });
|
|
46
|
+
process.exit(255);
|
|
47
|
+
}
|
|
48
|
+
await app.register(fastifyHelmet, {
|
|
49
|
+
contentSecurityPolicy: false,
|
|
50
|
+
global: true
|
|
51
|
+
});
|
|
52
|
+
await app.register(fastifyCors, corsOptions);
|
|
53
|
+
await app.register(fastifyCompress);
|
|
54
|
+
await app.register(fastifyCookie);
|
|
55
|
+
await app.register(fastifyFormbody);
|
|
56
|
+
await app.register(dictionaryRouter, { prefix: "/api/dictionary" });
|
|
57
|
+
await app.register(configurationRouter, { prefix: "/api/config" });
|
|
58
|
+
await app.register(fastifyStatic, {
|
|
59
|
+
root: clientDistPath,
|
|
60
|
+
wildcard: false
|
|
61
|
+
});
|
|
62
|
+
app.setNotFoundHandler((req, reply) => {
|
|
63
|
+
const requestedPath = join(clientDistPath, req.raw.url || "/");
|
|
64
|
+
if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {
|
|
65
|
+
const mimeType = mime.getType(requestedPath) ?? "application/octet-stream";
|
|
66
|
+
reply.header("Content-Type", mimeType);
|
|
67
|
+
return reply.sendFile(req.raw.url?.split("/").pop() || "index.html");
|
|
68
|
+
} else return reply.sendFile("index.html");
|
|
69
|
+
});
|
|
70
|
+
try {
|
|
71
|
+
await app.listen({
|
|
72
|
+
port,
|
|
73
|
+
host: "0.0.0.0"
|
|
74
|
+
});
|
|
75
|
+
const dotEnvFilePath = getEnvFilePath(envFileOptions.env, envFileOptions.envFile);
|
|
76
|
+
console.log(`
|
|
77
|
+
${colorize(colorize("INTLAYER", ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}
|
|
78
|
+
|
|
79
|
+
Editor running at: ${colorizePath(`http://localhost:${port}`)}
|
|
80
|
+
${colorize("➜", ANSIColors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === "" ? "-" : colorizePath(config.editor.applicationURL)}
|
|
81
|
+
${colorize("➜", ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? "-"}
|
|
82
|
+
${colorize("➜", ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? "-"}
|
|
83
|
+
`);
|
|
84
|
+
} catch (err) {
|
|
85
|
+
app.log.error(err);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
startServer(app);
|
|
90
|
+
|
|
91
|
+
//#endregion
|
|
9
92
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { existsSync, lstatSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport fastifyCompress from '@fastify/compress';\nimport fastifyCookie from '@fastify/cookie';\nimport fastifyCors, { type FastifyCorsOptions } from '@fastify/cors';\nimport fastifyFormbody from '@fastify/formbody';\nimport fastifyHelmet from '@fastify/helmet';\nimport fastifyStatic from '@fastify/static';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport { colorize, colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { configurationRouter } from '@routes/config.routes';\nimport { dictionaryRouter } from '@routes/dictionary.routes';\nimport { checkPortAvailability } from '@utils/checkPortAvailability';\nimport Fastify, { type FastifyInstance } from 'fastify';\nimport { intlayer } from 'fastify-intlayer';\nimport mime from 'mime';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst envFileOptions = {\n env: process.env.NODE_ENV,\n envFile: process.env.ENV_FILE,\n};\n\nconst FALLBACK_PORT = 8000;\nconst config = getConfiguration(envFileOptions);\n\nconst appLogger = getAppLogger(config);\nconst port = config.editor.port ?? FALLBACK_PORT;\n\nif (!config.editor.enabled) {\n appLogger(\n `Editor is not enabled. Add ${colorize('editor.enabled', ANSIColors.BLUE)} to ${colorizePath('intlayer.config.ts')} file to enable it.`,\n {\n level: 'error',\n }\n );\n process.exit(0);\n}\n\n// Load package.json\nconst packageJson = JSON.parse(\n readFileSync(resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst app: FastifyInstance = Fastify({\n disableRequestLogging: true, // Optional: Keep logs clean like the original\n});\n\n// Load internationalization plugin\n// Assuming fastify-intlayer is the Fastify equivalent of express-intlayer\napp.register(intlayer);\n\nconst clientDistPath = resolve(__dirname, '../../client/dist');\n\nconst corsOptions: FastifyCorsOptions = {\n origin: '*',\n credentials: true,\n};\n\nconst startServer = async (app: FastifyInstance) => {\n const isPortAvailable = await checkPortAvailability(port);\n\n if (!isPortAvailable) {\n appLogger(`Error: Port ${port} is already in use.`, {\n level: 'error',\n });\n process.exit(255);\n }\n\n // Security Headers\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n // CORS\n await app.register(fastifyCors, corsOptions);\n\n // Compression\n await app.register(fastifyCompress);\n\n // Cookie Parser\n await app.register(fastifyCookie);\n\n // Parse application/x-www-form-urlencoded\n await app.register(fastifyFormbody);\n\n // Register Routes\n await app.register(dictionaryRouter, { prefix: '/api/dictionary' });\n await app.register(configurationRouter, { prefix: '/api/config' });\n\n // Serve Static Files\n await app.register(fastifyStatic, {\n root: clientDistPath,\n wildcard: false, // We handle the fallback manually to match SPA logic\n });\n\n // For single-page applications, redirect all unmatched routes to index.html\n app.setNotFoundHandler((req, reply) => {\n const requestedPath = join(clientDistPath, req.raw.url || '/');\n\n if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {\n const mimeType =\n mime.getType(requestedPath) ?? 'application/octet-stream';\n reply.header('Content-Type', mimeType);\n return reply.sendFile(req.raw.url?.split('/').pop() || 'index.html');\n } else {\n return reply.sendFile('index.html');\n }\n });\n\n try {\n await app.listen({ port, host: '0.0.0.0' });\n\n const dotEnvFilePath = getEnvFilePath(\n envFileOptions.env,\n envFileOptions.envFile\n );\n\n console.log(`\n ${colorize(colorize('INTLAYER', ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}\n\n Editor running at: ${colorizePath(`http://localhost:${port}`)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === '' ? '-' : colorizePath(config.editor.applicationURL)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? '-'}\n ${colorize('➜', ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? '-'}\n `);\n } catch (err) {\n app.log.error(err);\n process.exit(1);\n }\n};\n\n// Start it up!\nstartServer(app);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { existsSync, lstatSync, readFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport fastifyCompress from '@fastify/compress';\nimport fastifyCookie from '@fastify/cookie';\nimport fastifyCors, { type FastifyCorsOptions } from '@fastify/cors';\nimport fastifyFormbody from '@fastify/formbody';\nimport fastifyHelmet from '@fastify/helmet';\nimport fastifyStatic from '@fastify/static';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport { colorize, colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { configurationRouter } from '@routes/config.routes';\nimport { dictionaryRouter } from '@routes/dictionary.routes';\nimport { checkPortAvailability } from '@utils/checkPortAvailability';\nimport Fastify, { type FastifyInstance } from 'fastify';\nimport { intlayer } from 'fastify-intlayer';\nimport mime from 'mime';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nconst envFileOptions = {\n env: process.env.NODE_ENV,\n envFile: process.env.ENV_FILE,\n};\n\nconst FALLBACK_PORT = 8000;\nconst config = getConfiguration(envFileOptions);\n\nconst appLogger = getAppLogger(config);\nconst port = config.editor.port ?? FALLBACK_PORT;\n\nif (!config.editor.enabled) {\n appLogger(\n `Editor is not enabled. Add ${colorize('editor.enabled', ANSIColors.BLUE)} to ${colorizePath('intlayer.config.ts')} file to enable it.`,\n {\n level: 'error',\n }\n );\n process.exit(0);\n}\n\n// Load package.json\nconst packageJson = JSON.parse(\n readFileSync(resolve(__dirname, '../../package.json'), 'utf8')\n);\n\nconst app: FastifyInstance = Fastify({\n disableRequestLogging: true, // Optional: Keep logs clean like the original\n});\n\n// Load internationalization plugin\n// Assuming fastify-intlayer is the Fastify equivalent of express-intlayer\napp.register(intlayer);\n\nconst clientDistPath = resolve(__dirname, '../../client/dist');\n\nconst corsOptions: FastifyCorsOptions = {\n origin: '*',\n credentials: true,\n};\n\nconst startServer = async (app: FastifyInstance) => {\n const isPortAvailable = await checkPortAvailability(port);\n\n if (!isPortAvailable) {\n appLogger(`Error: Port ${port} is already in use.`, {\n level: 'error',\n });\n process.exit(255);\n }\n\n // Security Headers\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n // CORS\n await app.register(fastifyCors, corsOptions);\n\n // Compression\n await app.register(fastifyCompress);\n\n // Cookie Parser\n await app.register(fastifyCookie);\n\n // Parse application/x-www-form-urlencoded\n await app.register(fastifyFormbody);\n\n // Register Routes\n await app.register(dictionaryRouter, { prefix: '/api/dictionary' });\n await app.register(configurationRouter, { prefix: '/api/config' });\n\n // Serve Static Files\n await app.register(fastifyStatic, {\n root: clientDistPath,\n wildcard: false, // We handle the fallback manually to match SPA logic\n });\n\n // For single-page applications, redirect all unmatched routes to index.html\n app.setNotFoundHandler((req, reply) => {\n const requestedPath = join(clientDistPath, req.raw.url || '/');\n\n if (existsSync(requestedPath) && lstatSync(requestedPath).isFile()) {\n const mimeType =\n mime.getType(requestedPath) ?? 'application/octet-stream';\n reply.header('Content-Type', mimeType);\n return reply.sendFile(req.raw.url?.split('/').pop() || 'index.html');\n } else {\n return reply.sendFile('index.html');\n }\n });\n\n try {\n await app.listen({ port, host: '0.0.0.0' });\n\n const dotEnvFilePath = getEnvFilePath(\n envFileOptions.env,\n envFileOptions.envFile\n );\n\n console.log(`\n ${colorize(colorize('INTLAYER', ANSIColors.BOLD), ANSIColors.GREY_DARK)} ${colorize(`v${packageJson.version}`, ANSIColors.GREY_DARK)}\n\n Editor running at: ${colorizePath(`http://localhost:${port}`)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Watching application at: ${config.editor.applicationURL === '' ? '-' : colorizePath(config.editor.applicationURL)}\n ${colorize('➜', ANSIColors.GREY_DARK)} Access key: ${config.editor.clientId ?? '-'}\n ${colorize('➜', ANSIColors.GREY_DARK)} Environment: ${dotEnvFilePath ?? '-'}\n `);\n } catch (err) {\n app.log.error(err);\n process.exit(1);\n }\n};\n\n// Start it up!\nstartServer(app);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,MAAM,YAAY,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;AAEzD,MAAM,iBAAiB;CACrB;CACA,SAAS,QAAQ,IAAI;CACtB;AAED,MAAM,gBAAgB;AACtB,MAAM,SAAS,iBAAiB,eAAe;AAE/C,MAAM,YAAY,aAAa,OAAO;AACtC,MAAM,OAAO,OAAO,OAAO,QAAQ;AAEnC,IAAI,CAAC,OAAO,OAAO,SAAS;AAC1B,WACE,8BAA8B,SAAS,kBAAkB,WAAW,KAAK,CAAC,MAAM,aAAa,qBAAqB,CAAC,sBACnH,EACE,OAAO,SACR,CACF;AACD,SAAQ,KAAK,EAAE;;AAIjB,MAAM,cAAc,KAAK,MACvB,aAAa,QAAQ,WAAW,qBAAqB,EAAE,OAAO,CAC/D;AAED,MAAM,MAAuB,QAAQ,EACnC,uBAAuB,MACxB,CAAC;AAIF,IAAI,SAAS,SAAS;AAEtB,MAAM,iBAAiB,QAAQ,WAAW,oBAAoB;AAE9D,MAAM,cAAkC;CACtC,QAAQ;CACR,aAAa;CACd;AAED,MAAM,cAAc,OAAO,QAAyB;AAGlD,KAAI,CAFoB,MAAM,sBAAsB,KAAK,EAEnC;AACpB,YAAU,eAAe,KAAK,sBAAsB,EAClD,OAAO,SACR,CAAC;AACF,UAAQ,KAAK,IAAI;;AAInB,OAAM,IAAI,SAAS,eAAe;EAChC,uBAAuB;EACvB,QAAQ;EACT,CAAC;AAGF,OAAM,IAAI,SAAS,aAAa,YAAY;AAG5C,OAAM,IAAI,SAAS,gBAAgB;AAGnC,OAAM,IAAI,SAAS,cAAc;AAGjC,OAAM,IAAI,SAAS,gBAAgB;AAGnC,OAAM,IAAI,SAAS,kBAAkB,EAAE,QAAQ,mBAAmB,CAAC;AACnE,OAAM,IAAI,SAAS,qBAAqB,EAAE,QAAQ,eAAe,CAAC;AAGlE,OAAM,IAAI,SAAS,eAAe;EAChC,MAAM;EACN,UAAU;EACX,CAAC;AAGF,KAAI,oBAAoB,KAAK,UAAU;EACrC,MAAM,gBAAgB,KAAK,gBAAgB,IAAI,IAAI,OAAO,IAAI;AAE9D,MAAI,WAAW,cAAc,IAAI,UAAU,cAAc,CAAC,QAAQ,EAAE;GAClE,MAAM,WACJ,KAAK,QAAQ,cAAc,IAAI;AACjC,SAAM,OAAO,gBAAgB,SAAS;AACtC,UAAO,MAAM,SAAS,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,KAAK,IAAI,aAAa;QAEpE,QAAO,MAAM,SAAS,aAAa;GAErC;AAEF,KAAI;AACF,QAAM,IAAI,OAAO;GAAE;GAAM,MAAM;GAAW,CAAC;EAE3C,MAAM,iBAAiB,eACrB,eAAe,KACf,eAAe,QAChB;AAED,UAAQ,IAAI;MACV,SAAS,SAAS,YAAY,WAAW,KAAK,EAAE,WAAW,UAAU,CAAC,GAAG,SAAS,IAAI,YAAY,WAAW,WAAW,UAAU,CAAC;;mCAEtG,aAAa,oBAAoB,OAAO,CAAC;MACtE,SAAS,KAAK,WAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,mBAAmB,KAAK,MAAM,aAAa,OAAO,OAAO,eAAe,CAAC;MACzJ,SAAS,KAAK,WAAW,UAAU,CAAC,8BAA8B,OAAO,OAAO,YAAY,IAAI;MAChG,SAAS,KAAK,WAAW,UAAU,CAAC,8BAA8B,kBAAkB,IAAI;MACxF;UACK,KAAK;AACZ,MAAI,IAAI,MAAM,IAAI;AAClB,UAAQ,KAAK,EAAE;;;AAKnB,YAAY,IAAI"}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_controllers_configuration_controller = require('../controllers/configuration.controller.cjs');
|
|
4
|
+
let _intlayer_config_node = require("@intlayer/config/node");
|
|
5
|
+
|
|
6
|
+
//#region src/routes/config.routes.ts
|
|
7
|
+
const { editor } = (0, _intlayer_config_node.getConfiguration)();
|
|
8
|
+
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
9
|
+
const getConfigurationRoutes = () => ({ getConfiguration: {
|
|
10
|
+
urlModel: "/",
|
|
11
|
+
url: getBaseURL(),
|
|
12
|
+
method: "GET"
|
|
13
|
+
} });
|
|
14
|
+
const configurationRouter = async (fastify) => {
|
|
15
|
+
fastify.get(getConfigurationRoutes().getConfiguration.urlModel, require_controllers_configuration_controller.getConfiguration);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
exports.configurationRouter = configurationRouter;
|
|
20
|
+
exports.getConfigurationRoutes = getConfigurationRoutes;
|
|
2
21
|
//# sourceMappingURL=config.routes.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.routes.cjs","names":[],"sources":["../../src/routes/config.routes.ts"],"sourcesContent":["import * as configurationController from '@controllers/configuration.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getConfigurationRoutes = () =>\n ({\n getConfiguration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n }) satisfies Routes;\n\nexport const configurationRouter = async (fastify: FastifyInstance) => {\n fastify.get(\n getConfigurationRoutes().getConfiguration.urlModel,\n configurationController.getConfiguration\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.routes.cjs","names":[],"sources":["../../src/routes/config.routes.ts"],"sourcesContent":["import * as configurationController from '@controllers/configuration.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getConfigurationRoutes = () =>\n ({\n getConfiguration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n }) satisfies Routes;\n\nexport const configurationRouter = async (fastify: FastifyInstance) => {\n fastify.get(\n getConfigurationRoutes().getConfiguration.urlModel,\n configurationController.getConfiguration\n );\n};\n"],"mappings":";;;;;;AAKA,MAAM,EAAE,wDAA6B;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,gCACV,EACC,kBAAkB;CAChB,UAAU;CACV,KAAK,YAAY;CACjB,QAAQ;CACT,EACF;AAEH,MAAa,sBAAsB,OAAO,YAA6B;AACrE,SAAQ,IACN,wBAAwB,CAAC,iBAAiB,wEAE3C"}
|
|
@@ -1,2 +1,18 @@
|
|
|
1
|
-
import{getConfiguration as
|
|
1
|
+
import { getConfiguration as getConfiguration$1 } from "../controllers/configuration.controller.mjs";
|
|
2
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
3
|
+
|
|
4
|
+
//#region src/routes/config.routes.ts
|
|
5
|
+
const { editor } = getConfiguration();
|
|
6
|
+
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
7
|
+
const getConfigurationRoutes = () => ({ getConfiguration: {
|
|
8
|
+
urlModel: "/",
|
|
9
|
+
url: getBaseURL(),
|
|
10
|
+
method: "GET"
|
|
11
|
+
} });
|
|
12
|
+
const configurationRouter = async (fastify) => {
|
|
13
|
+
fastify.get(getConfigurationRoutes().getConfiguration.urlModel, getConfiguration$1);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { configurationRouter, getConfigurationRoutes };
|
|
2
18
|
//# sourceMappingURL=config.routes.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.routes.mjs","names":["configurationController.getConfiguration"],"sources":["../../src/routes/config.routes.ts"],"sourcesContent":["import * as configurationController from '@controllers/configuration.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getConfigurationRoutes = () =>\n ({\n getConfiguration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n }) satisfies Routes;\n\nexport const configurationRouter = async (fastify: FastifyInstance) => {\n fastify.get(\n getConfigurationRoutes().getConfiguration.urlModel,\n configurationController.getConfiguration\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.routes.mjs","names":["configurationController.getConfiguration"],"sources":["../../src/routes/config.routes.ts"],"sourcesContent":["import * as configurationController from '@controllers/configuration.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getConfigurationRoutes = () =>\n ({\n getConfiguration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n }) satisfies Routes;\n\nexport const configurationRouter = async (fastify: FastifyInstance) => {\n fastify.get(\n getConfigurationRoutes().getConfiguration.urlModel,\n configurationController.getConfiguration\n );\n};\n"],"mappings":";;;;AAKA,MAAM,EAAE,WAAW,kBAAkB;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,gCACV,EACC,kBAAkB;CAChB,UAAU;CACV,KAAK,YAAY;CACjB,QAAQ;CACT,EACF;AAEH,MAAa,sBAAsB,OAAO,YAA6B;AACrE,SAAQ,IACN,wBAAwB,CAAC,iBAAiB,UAC1CA,mBACD"}
|
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_controllers_dictionary_controller = require('../controllers/dictionary.controller.cjs');
|
|
4
|
+
let _intlayer_config_node = require("@intlayer/config/node");
|
|
5
|
+
|
|
6
|
+
//#region src/routes/dictionary.routes.ts
|
|
7
|
+
const { editor } = (0, _intlayer_config_node.getConfiguration)();
|
|
8
|
+
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
9
|
+
const getDictionaryRoutes = () => ({
|
|
10
|
+
getDictionaries: {
|
|
11
|
+
urlModel: "/",
|
|
12
|
+
url: getBaseURL(),
|
|
13
|
+
method: "GET"
|
|
14
|
+
},
|
|
15
|
+
writeContentDeclaration: {
|
|
16
|
+
urlModel: "/",
|
|
17
|
+
url: getBaseURL(),
|
|
18
|
+
method: "POST"
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const dictionaryRouter = async (fastify) => {
|
|
22
|
+
fastify.get(getDictionaryRoutes().getDictionaries.urlModel, require_controllers_dictionary_controller.getDictionaries);
|
|
23
|
+
fastify.post(getDictionaryRoutes().writeContentDeclaration.urlModel, require_controllers_dictionary_controller.writeContentDeclaration);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.dictionaryRouter = dictionaryRouter;
|
|
28
|
+
exports.getDictionaryRoutes = getDictionaryRoutes;
|
|
2
29
|
//# sourceMappingURL=dictionary.routes.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.routes.cjs","names":["getDictionaries","writeContentDeclaration"],"sources":["../../src/routes/dictionary.routes.ts"],"sourcesContent":["import {\n getDictionaries,\n writeContentDeclaration,\n} from '@controllers/dictionary.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getDictionaryRoutes = () =>\n ({\n getDictionaries: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n writeContentDeclaration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'POST',\n },\n }) satisfies Routes;\n\nexport const dictionaryRouter = async (fastify: FastifyInstance) => {\n fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);\n fastify.post(\n getDictionaryRoutes().writeContentDeclaration.urlModel,\n writeContentDeclaration\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.routes.cjs","names":["getDictionaries","writeContentDeclaration"],"sources":["../../src/routes/dictionary.routes.ts"],"sourcesContent":["import {\n getDictionaries,\n writeContentDeclaration,\n} from '@controllers/dictionary.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getDictionaryRoutes = () =>\n ({\n getDictionaries: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n writeContentDeclaration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'POST',\n },\n }) satisfies Routes;\n\nexport const dictionaryRouter = async (fastify: FastifyInstance) => {\n fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);\n fastify.post(\n getDictionaryRoutes().writeContentDeclaration.urlModel,\n writeContentDeclaration\n );\n};\n"],"mappings":";;;;;;AAQA,MAAM,EAAE,wDAA6B;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,6BACV;CACC,iBAAiB;EACf,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACD,yBAAyB;EACvB,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACF;AAEH,MAAa,mBAAmB,OAAO,YAA6B;AAClE,SAAQ,IAAI,qBAAqB,CAAC,gBAAgB,UAAUA,0DAAgB;AAC5E,SAAQ,KACN,qBAAqB,CAAC,wBAAwB,UAC9CC,kEACD"}
|
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
import{getDictionaries
|
|
1
|
+
import { getDictionaries, writeContentDeclaration } from "../controllers/dictionary.controller.mjs";
|
|
2
|
+
import { getConfiguration } from "@intlayer/config/node";
|
|
3
|
+
|
|
4
|
+
//#region src/routes/dictionary.routes.ts
|
|
5
|
+
const { editor } = getConfiguration();
|
|
6
|
+
const getBaseURL = () => `${editor.editorURL}/api/dictionary`;
|
|
7
|
+
const getDictionaryRoutes = () => ({
|
|
8
|
+
getDictionaries: {
|
|
9
|
+
urlModel: "/",
|
|
10
|
+
url: getBaseURL(),
|
|
11
|
+
method: "GET"
|
|
12
|
+
},
|
|
13
|
+
writeContentDeclaration: {
|
|
14
|
+
urlModel: "/",
|
|
15
|
+
url: getBaseURL(),
|
|
16
|
+
method: "POST"
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const dictionaryRouter = async (fastify) => {
|
|
20
|
+
fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);
|
|
21
|
+
fastify.post(getDictionaryRoutes().writeContentDeclaration.urlModel, writeContentDeclaration);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
export { dictionaryRouter, getDictionaryRoutes };
|
|
2
26
|
//# sourceMappingURL=dictionary.routes.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictionary.routes.mjs","names":[],"sources":["../../src/routes/dictionary.routes.ts"],"sourcesContent":["import {\n getDictionaries,\n writeContentDeclaration,\n} from '@controllers/dictionary.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getDictionaryRoutes = () =>\n ({\n getDictionaries: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n writeContentDeclaration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'POST',\n },\n }) satisfies Routes;\n\nexport const dictionaryRouter = async (fastify: FastifyInstance) => {\n fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);\n fastify.post(\n getDictionaryRoutes().writeContentDeclaration.urlModel,\n writeContentDeclaration\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"dictionary.routes.mjs","names":[],"sources":["../../src/routes/dictionary.routes.ts"],"sourcesContent":["import {\n getDictionaries,\n writeContentDeclaration,\n} from '@controllers/dictionary.controller';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { FastifyInstance } from 'fastify';\nimport type { Routes } from '@/types/Routes';\n\nconst { editor } = getConfiguration();\n\nconst getBaseURL = () => `${editor.editorURL}/api/dictionary`;\n\nexport const getDictionaryRoutes = () =>\n ({\n getDictionaries: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'GET',\n },\n writeContentDeclaration: {\n urlModel: '/',\n url: getBaseURL(),\n method: 'POST',\n },\n }) satisfies Routes;\n\nexport const dictionaryRouter = async (fastify: FastifyInstance) => {\n fastify.get(getDictionaryRoutes().getDictionaries.urlModel, getDictionaries);\n fastify.post(\n getDictionaryRoutes().writeContentDeclaration.urlModel,\n writeContentDeclaration\n );\n};\n"],"mappings":";;;;AAQA,MAAM,EAAE,WAAW,kBAAkB;AAErC,MAAM,mBAAmB,GAAG,OAAO,UAAU;AAE7C,MAAa,6BACV;CACC,iBAAiB;EACf,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACD,yBAAyB;EACvB,UAAU;EACV,KAAK,YAAY;EACjB,QAAQ;EACT;CACF;AAEH,MAAa,mBAAmB,OAAO,YAA6B;AAClE,SAAQ,IAAI,qBAAqB,CAAC,gBAAgB,UAAU,gBAAgB;AAC5E,SAAQ,KACN,qBAAqB,CAAC,wBAAwB,UAC9C,wBACD"}
|
|
@@ -1 +1,24 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let node_net = require("node:net");
|
|
4
|
+
node_net = require_runtime.__toESM(node_net);
|
|
5
|
+
|
|
6
|
+
//#region src/utils/checkPortAvailability.ts
|
|
7
|
+
const checkPortAvailability = (port) => {
|
|
8
|
+
return new Promise((resolve) => {
|
|
9
|
+
const server = node_net.default.createServer();
|
|
10
|
+
server.once("error", (err) => {
|
|
11
|
+
if (err.code === "EADDRINUSE") resolve(false);
|
|
12
|
+
else resolve(true);
|
|
13
|
+
});
|
|
14
|
+
server.once("listening", () => {
|
|
15
|
+
server.close();
|
|
16
|
+
resolve(true);
|
|
17
|
+
});
|
|
18
|
+
server.listen(port);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.checkPortAvailability = checkPortAvailability;
|
|
24
|
+
//# sourceMappingURL=checkPortAvailability.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPortAvailability.cjs","names":["net"],"sources":["../../src/utils/checkPortAvailability.ts"],"sourcesContent":["import net from 'node:net';\n\nexport const checkPortAvailability = (port: number): Promise<boolean> => {\n return new Promise((resolve) => {\n const server = net.createServer();\n\n server.once('error', (err: any) => {\n if (err.code === 'EADDRINUSE') {\n resolve(false); // Port is in use\n } else {\n resolve(true);\n }\n });\n\n server.once('listening', () => {\n server.close();\n resolve(true); // Port is available\n });\n\n server.listen(port);\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkPortAvailability.cjs","names":["net"],"sources":["../../src/utils/checkPortAvailability.ts"],"sourcesContent":["import net from 'node:net';\n\nexport const checkPortAvailability = (port: number): Promise<boolean> => {\n return new Promise((resolve) => {\n const server = net.createServer();\n\n server.once('error', (err: any) => {\n if (err.code === 'EADDRINUSE') {\n resolve(false); // Port is in use\n } else {\n resolve(true);\n }\n });\n\n server.once('listening', () => {\n server.close();\n resolve(true); // Port is available\n });\n\n server.listen(port);\n });\n};\n"],"mappings":";;;;;;AAEA,MAAa,yBAAyB,SAAmC;AACvE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAASA,iBAAI,cAAc;AAEjC,SAAO,KAAK,UAAU,QAAa;AACjC,OAAI,IAAI,SAAS,aACf,SAAQ,MAAM;OAEd,SAAQ,KAAK;IAEf;AAEF,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AAEF,SAAO,OAAO,KAAK;GACnB"}
|
|
@@ -1,2 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import net from "node:net";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/checkPortAvailability.ts
|
|
4
|
+
const checkPortAvailability = (port) => {
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
const server = net.createServer();
|
|
7
|
+
server.once("error", (err) => {
|
|
8
|
+
if (err.code === "EADDRINUSE") resolve(false);
|
|
9
|
+
else resolve(true);
|
|
10
|
+
});
|
|
11
|
+
server.once("listening", () => {
|
|
12
|
+
server.close();
|
|
13
|
+
resolve(true);
|
|
14
|
+
});
|
|
15
|
+
server.listen(port);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { checkPortAvailability };
|
|
2
21
|
//# sourceMappingURL=checkPortAvailability.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkPortAvailability.mjs","names":[],"sources":["../../src/utils/checkPortAvailability.ts"],"sourcesContent":["import net from 'node:net';\n\nexport const checkPortAvailability = (port: number): Promise<boolean> => {\n return new Promise((resolve) => {\n const server = net.createServer();\n\n server.once('error', (err: any) => {\n if (err.code === 'EADDRINUSE') {\n resolve(false); // Port is in use\n } else {\n resolve(true);\n }\n });\n\n server.once('listening', () => {\n server.close();\n resolve(true); // Port is available\n });\n\n server.listen(port);\n });\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"checkPortAvailability.mjs","names":[],"sources":["../../src/utils/checkPortAvailability.ts"],"sourcesContent":["import net from 'node:net';\n\nexport const checkPortAvailability = (port: number): Promise<boolean> => {\n return new Promise((resolve) => {\n const server = net.createServer();\n\n server.once('error', (err: any) => {\n if (err.code === 'EADDRINUSE') {\n resolve(false); // Port is in use\n } else {\n resolve(true);\n }\n });\n\n server.once('listening', () => {\n server.close();\n resolve(true); // Port is available\n });\n\n server.listen(port);\n });\n};\n"],"mappings":";;;AAEA,MAAa,yBAAyB,SAAmC;AACvE,QAAO,IAAI,SAAS,YAAY;EAC9B,MAAM,SAAS,IAAI,cAAc;AAEjC,SAAO,KAAK,UAAU,QAAa;AACjC,OAAI,IAAI,SAAS,aACf,SAAQ,MAAM;OAEd,SAAQ,KAAK;IAEf;AAEF,SAAO,KAAK,mBAAmB;AAC7B,UAAO,OAAO;AACd,WAAQ,KAAK;IACb;AAEF,SAAO,OAAO,KAAK;GACnB"}
|