@modern-js/server-generator 3.7.30 → 3.7.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +65 -45
- package/package.json +8 -8
- package/templates/base-template/js/server/modern.server.js.handlebars +33 -0
- package/templates/base-template/ts/server/modern.server.ts.handlebars +36 -0
- package/templates/base-template/js/server/index.js.handlebars +0 -9
- package/templates/base-template/ts/server/index.ts.handlebars +0 -11
package/dist/index.js
CHANGED
|
@@ -76028,13 +76028,13 @@ __export(src_exports, {
|
|
|
76028
76028
|
module.exports = __toCommonJS(src_exports);
|
|
76029
76029
|
var import_path7 = __toESM(require("path"));
|
|
76030
76030
|
|
|
76031
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.
|
|
76031
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/fs-extra.js
|
|
76032
76032
|
var import_fs_extra = __toESM(require_lib());
|
|
76033
76033
|
|
|
76034
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
76034
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
|
|
76035
76035
|
var FS_RESOURCE = "_codesmith_core_fs_resource";
|
|
76036
76036
|
|
|
76037
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
76037
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
|
|
76038
76038
|
function fsExists(path7) {
|
|
76039
76039
|
return __async(this, null, function* () {
|
|
76040
76040
|
try {
|
|
@@ -76046,10 +76046,10 @@ function fsExists(path7) {
|
|
|
76046
76046
|
});
|
|
76047
76047
|
}
|
|
76048
76048
|
|
|
76049
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.
|
|
76049
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/execa.js
|
|
76050
76050
|
var import_execa = __toESM(require_execa());
|
|
76051
76051
|
|
|
76052
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
76052
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/timeoutPromise.js
|
|
76053
76053
|
function timeoutPromise(promise, ms, reason = "Operation") {
|
|
76054
76054
|
return __async(this, null, function* () {
|
|
76055
76055
|
let timeoutId = null;
|
|
@@ -76073,11 +76073,11 @@ function timeoutPromise(promise, ms, reason = "Operation") {
|
|
|
76073
76073
|
});
|
|
76074
76074
|
}
|
|
76075
76075
|
|
|
76076
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
76076
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/constants.js
|
|
76077
76077
|
var NPM_API_TIMEOUT = 3e4;
|
|
76078
76078
|
var CATCHE_VALIDITY_PREIOD = 7 * 24 * 3600 * 1e3;
|
|
76079
76079
|
|
|
76080
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.
|
|
76080
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/semver.js
|
|
76081
76081
|
var import_semver = __toESM(require_semver2());
|
|
76082
76082
|
|
|
76083
76083
|
// ../../../../node_modules/.pnpm/axios@1.8.4_debug@4.3.7/node_modules/axios/lib/helpers/bind.js
|
|
@@ -79419,19 +79419,24 @@ var {
|
|
|
79419
79419
|
mergeConfig: mergeConfig2
|
|
79420
79420
|
} = axios_default;
|
|
79421
79421
|
|
|
79422
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
79422
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmRegistry.js
|
|
79423
79423
|
function getNpmRegistry() {
|
|
79424
79424
|
return __async(this, null, function* () {
|
|
79425
|
-
|
|
79426
|
-
"
|
|
79427
|
-
|
|
79428
|
-
|
|
79429
|
-
|
|
79430
|
-
|
|
79425
|
+
try {
|
|
79426
|
+
const { stdout } = yield (0, import_execa.default)("npm", [
|
|
79427
|
+
"config",
|
|
79428
|
+
"get",
|
|
79429
|
+
"registry",
|
|
79430
|
+
"--no-workspaces"
|
|
79431
|
+
]);
|
|
79432
|
+
return stdout.replace(/\/$/, "") || "https://registry.npmjs.org";
|
|
79433
|
+
} catch (error) {
|
|
79434
|
+
return "https://registry.npmjs.org";
|
|
79435
|
+
}
|
|
79431
79436
|
});
|
|
79432
79437
|
}
|
|
79433
79438
|
|
|
79434
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
79439
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmPackageInfo.js
|
|
79435
79440
|
var NpmPackageInfoCache = /* @__PURE__ */ new Map();
|
|
79436
79441
|
function getNpmPackageInfoWithCommand(pkgName, pkgVersion, options) {
|
|
79437
79442
|
return __async(this, null, function* () {
|
|
@@ -79482,7 +79487,7 @@ function getNpmPackageInfo(pkgName, pkgVersion, options) {
|
|
|
79482
79487
|
});
|
|
79483
79488
|
}
|
|
79484
79489
|
|
|
79485
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
79490
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmVersion.js
|
|
79486
79491
|
function getNpmVersion(packageName, options) {
|
|
79487
79492
|
return __async(this, null, function* () {
|
|
79488
79493
|
const { version = "latest" } = options || {};
|
|
@@ -79491,7 +79496,7 @@ function getNpmVersion(packageName, options) {
|
|
|
79491
79496
|
});
|
|
79492
79497
|
}
|
|
79493
79498
|
|
|
79494
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.
|
|
79499
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getPackageInfo.js
|
|
79495
79500
|
function getPackageInfo(packageName) {
|
|
79496
79501
|
if (!packageName) {
|
|
79497
79502
|
throw new Error("package is not exisit");
|
|
@@ -79515,16 +79520,16 @@ function getPackageInfo(packageName) {
|
|
|
79515
79520
|
};
|
|
79516
79521
|
}
|
|
79517
79522
|
|
|
79518
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.
|
|
79523
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/ora.js
|
|
79519
79524
|
var import_ora = __toESM(require_ora());
|
|
79520
79525
|
|
|
79521
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.6.
|
|
79526
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
|
|
79522
79527
|
var import_ejs = __toESM(require_ejs());
|
|
79523
79528
|
function renderString(template, fullData) {
|
|
79524
79529
|
return import_ejs.default.render(template, fullData) || "";
|
|
79525
79530
|
}
|
|
79526
79531
|
|
|
79527
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.6.
|
|
79532
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
|
|
79528
79533
|
var EjsAPI = class {
|
|
79529
79534
|
renderTemplate(_0, _1) {
|
|
79530
79535
|
return __async(this, arguments, function* (templateResource, target, parameters = {}) {
|
|
@@ -79559,7 +79564,7 @@ var EjsAPI = class {
|
|
|
79559
79564
|
}
|
|
79560
79565
|
};
|
|
79561
79566
|
|
|
79562
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.6.
|
|
79567
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
|
|
79563
79568
|
var import_path = __toESM(require("path"));
|
|
79564
79569
|
var FsAPI = class {
|
|
79565
79570
|
renderFile(resource, target) {
|
|
@@ -79588,7 +79593,7 @@ var FsAPI = class {
|
|
|
79588
79593
|
}
|
|
79589
79594
|
};
|
|
79590
79595
|
|
|
79591
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.6.
|
|
79596
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
|
|
79592
79597
|
function canUseGit() {
|
|
79593
79598
|
return __async(this, null, function* () {
|
|
79594
79599
|
try {
|
|
@@ -79672,7 +79677,7 @@ function gitCommit(cwd, commitMessage) {
|
|
|
79672
79677
|
});
|
|
79673
79678
|
}
|
|
79674
79679
|
|
|
79675
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.6.
|
|
79680
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
|
|
79676
79681
|
var GitAPI = class {
|
|
79677
79682
|
isInGitRepo() {
|
|
79678
79683
|
return __async(this, arguments, function* (cwd = this.generatorCore.outputPath) {
|
|
@@ -79728,7 +79733,7 @@ var GitAPI = class {
|
|
|
79728
79733
|
}
|
|
79729
79734
|
};
|
|
79730
79735
|
|
|
79731
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.6.
|
|
79736
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
|
|
79732
79737
|
var import_handlebars = __toESM(require_lib2());
|
|
79733
79738
|
function renderString2(template, fullData, registers) {
|
|
79734
79739
|
const helpers = __spreadValues({}, registers === null || registers === void 0 ? void 0 : registers.helpers);
|
|
@@ -79738,7 +79743,7 @@ function renderString2(template, fullData, registers) {
|
|
|
79738
79743
|
return import_handlebars.default.compile(template)(fullData) || "";
|
|
79739
79744
|
}
|
|
79740
79745
|
|
|
79741
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.6.
|
|
79746
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
|
|
79742
79747
|
var HandlebarsAPI = class {
|
|
79743
79748
|
registerHelp(helpers) {
|
|
79744
79749
|
return __async(this, null, function* () {
|
|
@@ -79895,7 +79900,7 @@ function __generator(thisArg, body) {
|
|
|
79895
79900
|
}
|
|
79896
79901
|
}
|
|
79897
79902
|
|
|
79898
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.
|
|
79903
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/npm.js
|
|
79899
79904
|
var import_execa5 = __toESM(require_execa());
|
|
79900
79905
|
function canUseNvm() {
|
|
79901
79906
|
return _canUseNvm.apply(this, arguments);
|
|
@@ -80116,7 +80121,7 @@ function _canUsePnpm() {
|
|
|
80116
80121
|
return _canUsePnpm.apply(this, arguments);
|
|
80117
80122
|
}
|
|
80118
80123
|
|
|
80119
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.6.
|
|
80124
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
|
|
80120
80125
|
function execaWithStreamLog(command, args, options) {
|
|
80121
80126
|
const promise = (0, import_execa.default)(command, args, __spreadProps(__spreadValues({}, options), {
|
|
80122
80127
|
stdin: "inherit",
|
|
@@ -80217,7 +80222,7 @@ function pnpmInstall(_0) {
|
|
|
80217
80222
|
});
|
|
80218
80223
|
}
|
|
80219
80224
|
|
|
80220
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.6.
|
|
80225
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.6.8_@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
|
|
80221
80226
|
var NpmAPI = class {
|
|
80222
80227
|
npmInstall({ cwd, registryUrl, ignoreScripts }) {
|
|
80223
80228
|
return npmInstall({
|
|
@@ -80245,7 +80250,7 @@ var NpmAPI = class {
|
|
|
80245
80250
|
}
|
|
80246
80251
|
};
|
|
80247
80252
|
|
|
80248
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.
|
|
80253
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/lodash.js
|
|
80249
80254
|
var import_lodash = __toESM(require_lodash());
|
|
80250
80255
|
var import_lodash2 = __toESM(require_lodash2());
|
|
80251
80256
|
var import_lodash3 = __toESM(require_lodash3());
|
|
@@ -86012,10 +86017,10 @@ var Schema = (
|
|
|
86012
86017
|
}()
|
|
86013
86018
|
);
|
|
86014
86019
|
|
|
86015
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.
|
|
86020
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
|
|
86016
86021
|
var import_inquirer = __toESM(require_inquirer());
|
|
86017
86022
|
|
|
86018
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.
|
|
86023
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
|
|
86019
86024
|
function validateSchema(schema) {
|
|
86020
86025
|
const { type, properties } = schema;
|
|
86021
86026
|
if (type !== "object") {
|
|
@@ -86102,7 +86107,7 @@ function transformForm(schema, configValue = {}, validateMap, initValue) {
|
|
|
86102
86107
|
return getQuestionFromSchema(schema, configValue, validateMap, initValue);
|
|
86103
86108
|
}
|
|
86104
86109
|
|
|
86105
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.
|
|
86110
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
|
|
86106
86111
|
var compileRule = (rule, scope) => {
|
|
86107
86112
|
const state = Schema.compile(rule, __spreadValues({
|
|
86108
86113
|
$self: {},
|
|
@@ -86202,7 +86207,7 @@ function prompt(_0) {
|
|
|
86202
86207
|
});
|
|
86203
86208
|
}
|
|
86204
86209
|
|
|
86205
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.
|
|
86210
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
|
|
86206
86211
|
var CLIReader = class {
|
|
86207
86212
|
getAnswers() {
|
|
86208
86213
|
return this.answers;
|
|
@@ -86230,7 +86235,7 @@ var CLIReader = class {
|
|
|
86230
86235
|
}
|
|
86231
86236
|
};
|
|
86232
86237
|
|
|
86233
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86238
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
|
|
86234
86239
|
var import_comment_json = __toESM(require_src3());
|
|
86235
86240
|
var import_inquirer2 = __toESM(require_inquirer2());
|
|
86236
86241
|
|
|
@@ -86297,7 +86302,7 @@ var I18n = class {
|
|
|
86297
86302
|
}
|
|
86298
86303
|
};
|
|
86299
86304
|
|
|
86300
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86305
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
|
|
86301
86306
|
var EN_LOCALE = {
|
|
86302
86307
|
environment: {
|
|
86303
86308
|
node_version: "The version of Node.js is too low. Please upgrade to the LTS version: https://nodejs.org/",
|
|
@@ -86324,7 +86329,7 @@ var EN_LOCALE = {
|
|
|
86324
86329
|
}
|
|
86325
86330
|
};
|
|
86326
86331
|
|
|
86327
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86332
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
|
|
86328
86333
|
var ZH_LOCALE = {
|
|
86329
86334
|
environment: {
|
|
86330
86335
|
node_version: "Node.js 版本太低,请升级至 LTS 版本: https://nodejs.org/",
|
|
@@ -86351,14 +86356,14 @@ var ZH_LOCALE = {
|
|
|
86351
86356
|
}
|
|
86352
86357
|
};
|
|
86353
86358
|
|
|
86354
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86359
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
|
|
86355
86360
|
var i18n = new I18n();
|
|
86356
86361
|
var localeKeys = i18n.init("zh", {
|
|
86357
86362
|
zh: ZH_LOCALE,
|
|
86358
86363
|
en: EN_LOCALE
|
|
86359
86364
|
});
|
|
86360
86365
|
|
|
86361
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86366
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
|
|
86362
86367
|
var import_path3 = __toESM(require("path"));
|
|
86363
86368
|
var NODE_MAJOR_VERSION_MAP = {
|
|
86364
86369
|
"lts/*": 18,
|
|
@@ -86369,7 +86374,8 @@ var NODE_MAJOR_VERSION_MAP = {
|
|
|
86369
86374
|
"lts/erbium": 12,
|
|
86370
86375
|
"lts/fermium": 14,
|
|
86371
86376
|
"lts/gallium": 16,
|
|
86372
|
-
"lts/hydrogen": 18
|
|
86377
|
+
"lts/hydrogen": 18,
|
|
86378
|
+
"lts/jod": 22
|
|
86373
86379
|
};
|
|
86374
86380
|
function getNoteVersion() {
|
|
86375
86381
|
return __async(this, null, function* () {
|
|
@@ -86409,7 +86415,7 @@ function checkUseNvm(cwd, logger) {
|
|
|
86409
86415
|
});
|
|
86410
86416
|
}
|
|
86411
86417
|
|
|
86412
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86418
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
|
|
86413
86419
|
function transformInquirerSchema(questions, configValue = {}, validateMap = {}, initValue = {}) {
|
|
86414
86420
|
for (const question of questions) {
|
|
86415
86421
|
question.default = initValue[question.name] || question.default;
|
|
@@ -86436,7 +86442,7 @@ function transformInquirerSchema(questions, configValue = {}, validateMap = {},
|
|
|
86436
86442
|
return questions;
|
|
86437
86443
|
}
|
|
86438
86444
|
|
|
86439
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.
|
|
86445
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.8_@modern-js+codesmith@2.6.8_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
|
|
86440
86446
|
var AppAPI = class {
|
|
86441
86447
|
checkEnvironment(nodeVersion) {
|
|
86442
86448
|
return __async(this, null, function* () {
|
|
@@ -86679,11 +86685,11 @@ var AppAPI = class {
|
|
|
86679
86685
|
}
|
|
86680
86686
|
};
|
|
86681
86687
|
|
|
86682
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.
|
|
86688
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.8/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
|
|
86683
86689
|
var import_comment_json2 = __toESM(require_src3());
|
|
86684
86690
|
var declarationUpdate = __toESM(require_dist());
|
|
86685
86691
|
|
|
86686
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.
|
|
86692
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.8/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
|
|
86687
86693
|
function editJson(generatorCore, resource, getNewJsonValue) {
|
|
86688
86694
|
return __async(this, null, function* () {
|
|
86689
86695
|
const originJsonValue = yield resource.value();
|
|
@@ -86698,7 +86704,7 @@ function editJson(generatorCore, resource, getNewJsonValue) {
|
|
|
86698
86704
|
});
|
|
86699
86705
|
}
|
|
86700
86706
|
|
|
86701
|
-
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.
|
|
86707
|
+
// ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.8/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
|
|
86702
86708
|
var JsonAPI = class {
|
|
86703
86709
|
get(resource) {
|
|
86704
86710
|
return __async(this, null, function* () {
|
|
@@ -88274,7 +88280,7 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
|
|
|
88274
88280
|
}
|
|
88275
88281
|
}
|
|
88276
88282
|
const language = isTsProject(appDir) ? Language.TS : Language.JS;
|
|
88277
|
-
const serverPlugin = "@modern-js/
|
|
88283
|
+
const serverPlugin = "@modern-js/server-runtime";
|
|
88278
88284
|
yield appApi.runSubGenerator(
|
|
88279
88285
|
getGeneratorPath(DependenceGenerator, context.config.distTag, [__dirname]),
|
|
88280
88286
|
void 0,
|
|
@@ -88325,6 +88331,20 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
|
|
|
88325
88331
|
if (!(yield appApi.checkEnvironment())) {
|
|
88326
88332
|
process.exit(1);
|
|
88327
88333
|
}
|
|
88334
|
+
const modernVersion = yield getModernPluginVersion(
|
|
88335
|
+
Solution.MWA,
|
|
88336
|
+
"@modern-js/app-tools",
|
|
88337
|
+
{ registry: context.config.registry, distTag: context.config.distTag }
|
|
88338
|
+
);
|
|
88339
|
+
if (import_semver.default.valid(modernVersion) && import_semver.default.lt(modernVersion, "2.67.5")) {
|
|
88340
|
+
generator.logger.warn(
|
|
88341
|
+
`🟡 The current Modern.js version ${modernVersion} does not support Custom Web Server. Please upgrade to at least version 2.67.5.`
|
|
88342
|
+
);
|
|
88343
|
+
throw Error(
|
|
88344
|
+
"The current Modern.js version does not support Custom Web Server. Please upgrade to at least version 1.67.5"
|
|
88345
|
+
);
|
|
88346
|
+
process.exit(1);
|
|
88347
|
+
}
|
|
88328
88348
|
generator.logger.debug(`🚀 [Start Run Server Generator]`);
|
|
88329
88349
|
generator.logger.debug(
|
|
88330
88350
|
"💡 [Current Config]:",
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.7.
|
|
18
|
+
"version": "3.7.32",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./src/index.ts",
|
|
21
21
|
"main": "./dist/index.js",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"/dist/index.js"
|
|
25
25
|
],
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@modern-js/codesmith": "2.6.
|
|
28
|
-
"@modern-js/codesmith-api-app": "2.6.
|
|
29
|
-
"@modern-js/codesmith-api-json": "2.6.
|
|
30
|
-
"@modern-js/codesmith-utils": "2.6.
|
|
27
|
+
"@modern-js/codesmith": "2.6.8",
|
|
28
|
+
"@modern-js/codesmith-api-app": "2.6.8",
|
|
29
|
+
"@modern-js/codesmith-api-json": "2.6.8",
|
|
30
|
+
"@modern-js/codesmith-utils": "2.6.8",
|
|
31
31
|
"@types/jest": "^29",
|
|
32
32
|
"@types/node": "^14",
|
|
33
33
|
"jest": "^29",
|
|
34
34
|
"typescript": "^5",
|
|
35
|
-
"@modern-js/dependence-generator": "3.7.
|
|
36
|
-
"@modern-js/generator-common": "3.7.
|
|
37
|
-
"@modern-js/generator-utils": "3.7.
|
|
35
|
+
"@modern-js/dependence-generator": "3.7.32",
|
|
36
|
+
"@modern-js/generator-common": "3.7.32",
|
|
37
|
+
"@modern-js/generator-utils": "3.7.32",
|
|
38
38
|
"@scripts/build": "2.66.0",
|
|
39
39
|
"@scripts/jest-config": "2.66.0"
|
|
40
40
|
},
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineServerConfig } from '@modern-js/server-runtime';
|
|
2
|
+
|
|
3
|
+
const renderTiming = async (c, next) => {
|
|
4
|
+
const start = Date.now();
|
|
5
|
+
|
|
6
|
+
await next();
|
|
7
|
+
|
|
8
|
+
console.log('render-timing', Date.now() - start);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const requestTiming = async (c, next) => {
|
|
12
|
+
const start = Date.now();
|
|
13
|
+
|
|
14
|
+
await next();
|
|
15
|
+
|
|
16
|
+
console.log('request-timing', Date.now() - start);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default defineServerConfig({
|
|
20
|
+
middlewares: [
|
|
21
|
+
{
|
|
22
|
+
name: 'request-timing',
|
|
23
|
+
handler: requestTiming,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
renderMiddlewares: [
|
|
27
|
+
{
|
|
28
|
+
name: 'render-timing',
|
|
29
|
+
handler: renderTiming,
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
plugins: [],
|
|
33
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type MiddlewareHandler,
|
|
3
|
+
defineServerConfig
|
|
4
|
+
} from '@modern-js/server-runtime';
|
|
5
|
+
|
|
6
|
+
const renderTiming: MiddlewareHandler = async (c, next) => {
|
|
7
|
+
const start = Date.now();
|
|
8
|
+
|
|
9
|
+
await next();
|
|
10
|
+
|
|
11
|
+
console.log('render-timing', Date.now() - start);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const requestTiming: MiddlewareHandler = async (c, next) => {
|
|
15
|
+
const start = Date.now();
|
|
16
|
+
|
|
17
|
+
await next();
|
|
18
|
+
|
|
19
|
+
console.log('request-timing', Date.now() - start);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default defineServerConfig({
|
|
23
|
+
middlewares: [
|
|
24
|
+
{
|
|
25
|
+
name: 'request-timing',
|
|
26
|
+
handler: requestTiming,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
renderMiddlewares: [
|
|
30
|
+
{
|
|
31
|
+
name: 'render-timing',
|
|
32
|
+
handler: renderTiming,
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
plugins: [],
|
|
36
|
+
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Middleware, AfterRenderHook } from '@modern-js/runtime/server';
|
|
2
|
-
|
|
3
|
-
export const middleware: Middleware = async (context, next) => {
|
|
4
|
-
console.info(`user access url:${context.request.pathname}`);
|
|
5
|
-
next();
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const afterRender: AfterRenderHook = (context, next) => {
|
|
9
|
-
context.template.appendBody('EdenX Server');
|
|
10
|
-
next();
|
|
11
|
-
};
|