@modern-js/bff-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 CHANGED
@@ -76029,16 +76029,16 @@ __export(src_exports, {
76029
76029
  module.exports = __toCommonJS(src_exports);
76030
76030
  var import_path6 = __toESM(require("path"));
76031
76031
 
76032
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/chalk.js
76032
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/chalk.js
76033
76033
  var import_chalk = __toESM(require_source());
76034
76034
 
76035
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/fs-extra.js
76035
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/fs-extra.js
76036
76036
  var import_fs_extra = __toESM(require_lib());
76037
76037
 
76038
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
76038
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/materials/FsResource.js
76039
76039
  var FS_RESOURCE = "_codesmith_core_fs_resource";
76040
76040
 
76041
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
76041
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/fsExists.js
76042
76042
  function fsExists(path6) {
76043
76043
  return __async(this, null, function* () {
76044
76044
  try {
@@ -76050,10 +76050,10 @@ function fsExists(path6) {
76050
76050
  });
76051
76051
  }
76052
76052
 
76053
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/execa.js
76053
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/execa.js
76054
76054
  var import_execa = __toESM(require_execa());
76055
76055
 
76056
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/utils/timeoutPromise.js
76056
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/timeoutPromise.js
76057
76057
  function timeoutPromise(promise, ms, reason = "Operation") {
76058
76058
  return __async(this, null, function* () {
76059
76059
  let timeoutId = null;
@@ -76077,11 +76077,11 @@ function timeoutPromise(promise, ms, reason = "Operation") {
76077
76077
  });
76078
76078
  }
76079
76079
 
76080
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/constants.js
76080
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/constants.js
76081
76081
  var NPM_API_TIMEOUT = 3e4;
76082
76082
  var CATCHE_VALIDITY_PREIOD = 7 * 24 * 3600 * 1e3;
76083
76083
 
76084
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/semver.js
76084
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/semver.js
76085
76085
  var import_semver = __toESM(require_semver2());
76086
76086
 
76087
76087
  // ../../../../node_modules/.pnpm/axios@1.8.4_debug@4.3.7/node_modules/axios/lib/helpers/bind.js
@@ -79423,19 +79423,24 @@ var {
79423
79423
  mergeConfig: mergeConfig2
79424
79424
  } = axios_default;
79425
79425
 
79426
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmRegistry.js
79426
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmRegistry.js
79427
79427
  function getNpmRegistry() {
79428
79428
  return __async(this, null, function* () {
79429
- const { stdout } = yield (0, import_execa.default)("npm", [
79430
- "config",
79431
- "get",
79432
- "registry"
79433
- ]);
79434
- return stdout.replace(/\/$/, "") || "https://registry.npmjs.org";
79429
+ try {
79430
+ const { stdout } = yield (0, import_execa.default)("npm", [
79431
+ "config",
79432
+ "get",
79433
+ "registry",
79434
+ "--no-workspaces"
79435
+ ]);
79436
+ return stdout.replace(/\/$/, "") || "https://registry.npmjs.org";
79437
+ } catch (error) {
79438
+ return "https://registry.npmjs.org";
79439
+ }
79435
79440
  });
79436
79441
  }
79437
79442
 
79438
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmPackageInfo.js
79443
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmPackageInfo.js
79439
79444
  var NpmPackageInfoCache = /* @__PURE__ */ new Map();
79440
79445
  function getNpmPackageInfoWithCommand(pkgName, pkgVersion, options) {
79441
79446
  return __async(this, null, function* () {
@@ -79486,7 +79491,7 @@ function getNpmPackageInfo(pkgName, pkgVersion, options) {
79486
79491
  });
79487
79492
  }
79488
79493
 
79489
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmVersion.js
79494
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getNpmVersion.js
79490
79495
  function getNpmVersion(packageName, options) {
79491
79496
  return __async(this, null, function* () {
79492
79497
  const { version = "latest" } = options || {};
@@ -79495,7 +79500,7 @@ function getNpmVersion(packageName, options) {
79495
79500
  });
79496
79501
  }
79497
79502
 
79498
- // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith/dist/esm-node/utils/getPackageInfo.js
79503
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith@2.6.8/node_modules/@modern-js/codesmith/dist/esm-node/utils/getPackageInfo.js
79499
79504
  function getPackageInfo(packageName) {
79500
79505
  if (!packageName) {
79501
79506
  throw new Error("package is not exisit");
@@ -79519,16 +79524,16 @@ function getPackageInfo(packageName) {
79519
79524
  };
79520
79525
  }
79521
79526
 
79522
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/ora.js
79527
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/ora.js
79523
79528
  var import_ora = __toESM(require_ora());
79524
79529
 
79525
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/utils/renderString.js
79530
+ // ../../../../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
79526
79531
  var import_ejs = __toESM(require_ejs());
79527
79532
  function renderString(template, fullData) {
79528
79533
  return import_ejs.default.render(template, fullData) || "";
79529
79534
  }
79530
79535
 
79531
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-ejs@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-ejs/dist/esm-node/index.js
79536
+ // ../../../../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
79532
79537
  var EjsAPI = class {
79533
79538
  renderTemplate(_0, _1) {
79534
79539
  return __async(this, arguments, function* (templateResource, target, parameters = {}) {
@@ -79563,7 +79568,7 @@ var EjsAPI = class {
79563
79568
  }
79564
79569
  };
79565
79570
 
79566
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-fs@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-fs/dist/esm-node/index.js
79571
+ // ../../../../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
79567
79572
  var import_path = __toESM(require("path"));
79568
79573
  var FsAPI = class {
79569
79574
  renderFile(resource, target) {
@@ -79592,7 +79597,7 @@ var FsAPI = class {
79592
79597
  }
79593
79598
  };
79594
79599
 
79595
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-git/dist/esm-node/utils/index.js
79600
+ // ../../../../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
79596
79601
  function canUseGit() {
79597
79602
  return __async(this, null, function* () {
79598
79603
  try {
@@ -79676,7 +79681,7 @@ function gitCommit(cwd, commitMessage) {
79676
79681
  });
79677
79682
  }
79678
79683
 
79679
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-git@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-git/dist/esm-node/index.js
79684
+ // ../../../../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
79680
79685
  var GitAPI = class {
79681
79686
  isInGitRepo() {
79682
79687
  return __async(this, arguments, function* (cwd = this.generatorCore.outputPath) {
@@ -79732,7 +79737,7 @@ var GitAPI = class {
79732
79737
  }
79733
79738
  };
79734
79739
 
79735
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/utils/renderString.js
79740
+ // ../../../../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
79736
79741
  var import_handlebars = __toESM(require_lib2());
79737
79742
  function renderString2(template, fullData, registers) {
79738
79743
  const helpers = __spreadValues({}, registers === null || registers === void 0 ? void 0 : registers.helpers);
@@ -79742,7 +79747,7 @@ function renderString2(template, fullData, registers) {
79742
79747
  return import_handlebars.default.compile(template)(fullData) || "";
79743
79748
  }
79744
79749
 
79745
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-handlebars@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-handlebars/dist/esm-node/index.js
79750
+ // ../../../../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
79746
79751
  var HandlebarsAPI = class {
79747
79752
  registerHelp(helpers) {
79748
79753
  return __async(this, null, function* () {
@@ -79899,7 +79904,7 @@ function __generator(thisArg, body) {
79899
79904
  }
79900
79905
  }
79901
79906
 
79902
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/npm.js
79907
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/npm.js
79903
79908
  var import_execa5 = __toESM(require_execa());
79904
79909
  function canUseNvm() {
79905
79910
  return _canUseNvm.apply(this, arguments);
@@ -80120,7 +80125,7 @@ function _canUsePnpm() {
80120
80125
  return _canUsePnpm.apply(this, arguments);
80121
80126
  }
80122
80127
 
80123
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/utils/install.js
80128
+ // ../../../../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
80124
80129
  function execaWithStreamLog(command, args, options) {
80125
80130
  const promise = (0, import_execa.default)(command, args, __spreadProps(__spreadValues({}, options), {
80126
80131
  stdin: "inherit",
@@ -80221,7 +80226,7 @@ function pnpmInstall(_0) {
80221
80226
  });
80222
80227
  }
80223
80228
 
80224
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-npm@2.6.7_@modern-js+codesmith@2.6.7/node_modules/@modern-js/codesmith-api-npm/dist/esm-node/index.js
80229
+ // ../../../../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
80225
80230
  var NpmAPI = class {
80226
80231
  npmInstall({ cwd, registryUrl, ignoreScripts }) {
80227
80232
  return npmInstall({
@@ -80249,7 +80254,7 @@ var NpmAPI = class {
80249
80254
  }
80250
80255
  };
80251
80256
 
80252
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.7/node_modules/@modern-js/codesmith-utils/dist/esm/lodash.js
80257
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-utils@2.6.8/node_modules/@modern-js/codesmith-utils/dist/esm/lodash.js
80253
80258
  var import_lodash = __toESM(require_lodash());
80254
80259
  var import_lodash2 = __toESM(require_lodash2());
80255
80260
  var import_lodash3 = __toESM(require_lodash3());
@@ -86016,10 +86021,10 @@ var Schema = (
86016
86021
  }()
86017
86022
  );
86018
86023
 
86019
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
86024
+ // ../../../../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
86020
86025
  var import_inquirer = __toESM(require_inquirer());
86021
86026
 
86022
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/transform.js
86027
+ // ../../../../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
86023
86028
  function validateSchema(schema) {
86024
86029
  const { type, properties } = schema;
86025
86030
  if (type !== "object") {
@@ -86106,7 +86111,7 @@ function transformForm(schema, configValue = {}, validateMap, initValue) {
86106
86111
  return getQuestionFromSchema(schema, configValue, validateMap, initValue);
86107
86112
  }
86108
86113
 
86109
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/prompt.js
86114
+ // ../../../../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
86110
86115
  var compileRule = (rule, scope) => {
86111
86116
  const state = Schema.compile(rule, __spreadValues({
86112
86117
  $self: {},
@@ -86206,7 +86211,7 @@ function prompt(_0) {
86206
86211
  });
86207
86212
  }
86208
86213
 
86209
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-formily@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-formily/dist/esm-node/inquirer.js
86214
+ // ../../../../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
86210
86215
  var CLIReader = class {
86211
86216
  getAnswers() {
86212
86217
  return this.answers;
@@ -86234,7 +86239,7 @@ var CLIReader = class {
86234
86239
  }
86235
86240
  };
86236
86241
 
86237
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
86242
+ // ../../../../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
86238
86243
  var import_comment_json = __toESM(require_src3());
86239
86244
  var import_inquirer2 = __toESM(require_inquirer2());
86240
86245
 
@@ -86301,7 +86306,7 @@ var I18n = class {
86301
86306
  }
86302
86307
  };
86303
86308
 
86304
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/en.js
86309
+ // ../../../../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
86305
86310
  var EN_LOCALE = {
86306
86311
  environment: {
86307
86312
  node_version: "The version of Node.js is too low. Please upgrade to the LTS version: https://nodejs.org/",
@@ -86328,7 +86333,7 @@ var EN_LOCALE = {
86328
86333
  }
86329
86334
  };
86330
86335
 
86331
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/zh.js
86336
+ // ../../../../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
86332
86337
  var ZH_LOCALE = {
86333
86338
  environment: {
86334
86339
  node_version: "Node.js 版本太低,请升级至 LTS 版本: https://nodejs.org/",
@@ -86355,14 +86360,14 @@ var ZH_LOCALE = {
86355
86360
  }
86356
86361
  };
86357
86362
 
86358
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/locale/index.js
86363
+ // ../../../../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
86359
86364
  var i18n = new I18n();
86360
86365
  var localeKeys = i18n.init("zh", {
86361
86366
  zh: ZH_LOCALE,
86362
86367
  en: EN_LOCALE
86363
86368
  });
86364
86369
 
86365
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/checkUseNvm.js
86370
+ // ../../../../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
86366
86371
  var import_path3 = __toESM(require("path"));
86367
86372
  var NODE_MAJOR_VERSION_MAP = {
86368
86373
  "lts/*": 18,
@@ -86373,7 +86378,8 @@ var NODE_MAJOR_VERSION_MAP = {
86373
86378
  "lts/erbium": 12,
86374
86379
  "lts/fermium": 14,
86375
86380
  "lts/gallium": 16,
86376
- "lts/hydrogen": 18
86381
+ "lts/hydrogen": 18,
86382
+ "lts/jod": 22
86377
86383
  };
86378
86384
  function getNoteVersion() {
86379
86385
  return __async(this, null, function* () {
@@ -86413,7 +86419,7 @@ function checkUseNvm(cwd, logger) {
86413
86419
  });
86414
86420
  }
86415
86421
 
86416
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/utils/transform.js
86422
+ // ../../../../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
86417
86423
  function transformInquirerSchema(questions, configValue = {}, validateMap = {}, initValue = {}) {
86418
86424
  for (const question of questions) {
86419
86425
  question.default = initValue[question.name] || question.default;
@@ -86440,7 +86446,7 @@ function transformInquirerSchema(questions, configValue = {}, validateMap = {},
86440
86446
  return questions;
86441
86447
  }
86442
86448
 
86443
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-app@2.6.7_@modern-js+codesmith@2.6.7_typescript@5.6.3/node_modules/@modern-js/codesmith-api-app/dist/esm-node/index.js
86449
+ // ../../../../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
86444
86450
  var AppAPI = class {
86445
86451
  checkEnvironment(nodeVersion) {
86446
86452
  return __async(this, null, function* () {
@@ -86683,11 +86689,11 @@ var AppAPI = class {
86683
86689
  }
86684
86690
  };
86685
86691
 
86686
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.7/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
86692
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.8/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
86687
86693
  var import_comment_json2 = __toESM(require_src3());
86688
86694
  var declarationUpdate = __toESM(require_dist());
86689
86695
 
86690
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.7/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
86696
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.8/node_modules/@modern-js/codesmith-api-json/dist/esm-node/utils/index.js
86691
86697
  function editJson(generatorCore, resource, getNewJsonValue) {
86692
86698
  return __async(this, null, function* () {
86693
86699
  const originJsonValue = yield resource.value();
@@ -86702,7 +86708,7 @@ function editJson(generatorCore, resource, getNewJsonValue) {
86702
86708
  });
86703
86709
  }
86704
86710
 
86705
- // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.7/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
86711
+ // ../../../../node_modules/.pnpm/@modern-js+codesmith-api-json@2.6.8/node_modules/@modern-js/codesmith-api-json/dist/esm-node/index.js
86706
86712
  var JsonAPI = class {
86707
86713
  get(resource) {
86708
86714
  return __async(this, null, function* () {
@@ -86984,203 +86990,6 @@ var Language;
86984
86990
  Language2["JS"] = "js";
86985
86991
  })(Language || (Language = {}));
86986
86992
 
86987
- // ../../generator-common/dist/esm-node/newAction/common/index.js
86988
- var ActionType;
86989
- (function(ActionType2) {
86990
- ActionType2["Function"] = "function";
86991
- ActionType2["Element"] = "element";
86992
- ActionType2["Refactor"] = "refactor";
86993
- })(ActionType || (ActionType = {}));
86994
- var ActionElement;
86995
- (function(ActionElement2) {
86996
- ActionElement2["Entry"] = "entry";
86997
- ActionElement2["Server"] = "server";
86998
- })(ActionElement || (ActionElement = {}));
86999
- var ActionFunction;
87000
- (function(ActionFunction2) {
87001
- ActionFunction2["TailwindCSS"] = "tailwindcss";
87002
- ActionFunction2["BFF"] = "bff";
87003
- ActionFunction2["MicroFrontend"] = "micro_frontend";
87004
- ActionFunction2["I18n"] = "i18n";
87005
- ActionFunction2["StorybookV7"] = "storybookV7";
87006
- ActionFunction2["RuntimeApi"] = "runtimeApi";
87007
- ActionFunction2["SSG"] = "ssg";
87008
- ActionFunction2["Polyfill"] = "polyfill";
87009
- ActionFunction2["Proxy"] = "proxy";
87010
- ActionFunction2["SWC"] = "swc";
87011
- ActionFunction2["ModuleDoc"] = "module_doc";
87012
- })(ActionFunction || (ActionFunction = {}));
87013
- var ActionRefactor;
87014
- (function(ActionRefactor2) {
87015
- ActionRefactor2["ReactRouter5"] = "react_router_5";
87016
- })(ActionRefactor || (ActionRefactor = {}));
87017
-
87018
- // ../../generator-common/dist/esm-node/mwa/common.js
87019
- var Framework;
87020
- (function(Framework2) {
87021
- Framework2["Express"] = "express";
87022
- Framework2["Koa"] = "koa";
87023
- })(Framework || (Framework = {}));
87024
- var getFrameworkSchema = (_extra = {}) => {
87025
- return {
87026
- type: "string",
87027
- title: i18n2.t(localeKeys2.framework.self),
87028
- enum: Object.values(Framework).map((framework) => ({
87029
- value: framework,
87030
- label: i18n2.t(localeKeys2.framework[framework])
87031
- }))
87032
- };
87033
- };
87034
- var FrameworkAppendTypeContent = {
87035
- ["express"]: `/// <reference types='@modern-js/plugin-express/types' />`,
87036
- ["koa"]: `/// <reference types='@modern-js/plugin-koa/types' />`
87037
- };
87038
-
87039
- // ../../generator-common/dist/esm-node/newAction/mwa/index.js
87040
- var MWAActionTypes = [
87041
- ActionType.Element,
87042
- ActionType.Function,
87043
- ActionType.Refactor
87044
- ];
87045
- var MWAActionFunctions = [
87046
- ActionFunction.TailwindCSS,
87047
- ActionFunction.BFF,
87048
- ActionFunction.SSG,
87049
- ActionFunction.SWC,
87050
- ActionFunction.MicroFrontend,
87051
- ActionFunction.Polyfill,
87052
- ActionFunction.Proxy,
87053
- ActionFunction.StorybookV7
87054
- ];
87055
- var MWAActionElements = [
87056
- ActionElement.Entry,
87057
- ActionElement.Server
87058
- ];
87059
- var MWAActionReactors = [
87060
- ActionRefactor.ReactRouter5
87061
- ];
87062
- var MWAActionTypesMap = {
87063
- [ActionType.Element]: MWAActionElements,
87064
- [ActionType.Function]: MWAActionFunctions,
87065
- [ActionType.Refactor]: MWAActionReactors
87066
- };
87067
- var MWAActionFunctionsDevDependencies = {
87068
- [ActionFunction.SSG]: "@modern-js/plugin-ssg",
87069
- [ActionFunction.StorybookV7]: "@modern-js/storybook",
87070
- [ActionFunction.Proxy]: "@modern-js/plugin-proxy",
87071
- [ActionFunction.TailwindCSS]: "tailwindcss",
87072
- [ActionFunction.SWC]: "@modern-js/plugin-swc"
87073
- };
87074
- var MWAActionFunctionsDependencies = {
87075
- [ActionFunction.BFF]: "@modern-js/plugin-bff",
87076
- [ActionFunction.MicroFrontend]: "@modern-js/plugin-garfish",
87077
- [ActionFunction.TailwindCSS]: "@modern-js/plugin-tailwindcss",
87078
- [ActionFunction.Polyfill]: "@modern-js/plugin-polyfill"
87079
- };
87080
- var MWAActionFunctionsAppendTypeContent = {
87081
- [ActionFunction.MicroFrontend]: `/// <reference types='@modern-js/plugin-garfish/types' />`
87082
- };
87083
- var MWAActionRefactorDependencies = {
87084
- [ActionRefactor.ReactRouter5]: "@modern-js/plugin-router-v5"
87085
- };
87086
- var MWAActionReactorAppendTypeContent = {
87087
- [ActionRefactor.ReactRouter5]: `/// <reference types='@modern-js/plugin-router-v5/types' />`
87088
- };
87089
- var MWANewActionGenerators = {
87090
- [ActionType.Element]: {
87091
- [ActionElement.Entry]: "@modern-js/entry-generator",
87092
- [ActionElement.Server]: "@modern-js/server-generator"
87093
- },
87094
- [ActionType.Function]: {
87095
- [ActionFunction.TailwindCSS]: "@modern-js/tailwindcss-generator",
87096
- [ActionFunction.BFF]: "@modern-js/bff-generator",
87097
- [ActionFunction.MicroFrontend]: "@modern-js/dependence-generator",
87098
- [ActionFunction.StorybookV7]: "@modern-js/storybook-next-generator",
87099
- [ActionFunction.SSG]: "@modern-js/ssg-generator",
87100
- [ActionFunction.Polyfill]: "@modern-js/dependence-generator",
87101
- [ActionFunction.Proxy]: "@modern-js/dependence-generator",
87102
- [ActionFunction.SWC]: "@modern-js/dependence-generator"
87103
- },
87104
- [ActionType.Refactor]: {
87105
- [ActionRefactor.ReactRouter5]: "@modern-js/router-v5-generator"
87106
- }
87107
- };
87108
- var MWANewActionPluginName = {
87109
- [ActionType.Element]: {
87110
- [ActionElement.Server]: "serverPlugin"
87111
- },
87112
- [ActionType.Function]: {
87113
- [ActionFunction.TailwindCSS]: "tailwindcssPlugin",
87114
- [ActionFunction.BFF]: "bffPlugin",
87115
- [ActionFunction.MicroFrontend]: "garfishPlugin",
87116
- [ActionFunction.SSG]: "ssgPlugin",
87117
- [ActionFunction.Polyfill]: "polyfillPlugin",
87118
- [ActionFunction.Proxy]: "proxyPlugin",
87119
- [ActionFunction.SWC]: "swcPlugin"
87120
- },
87121
- [ActionType.Refactor]: {
87122
- [ActionRefactor.ReactRouter5]: "routerPlugin"
87123
- }
87124
- };
87125
- var MWANewActionPluginDependence = {
87126
- [ActionType.Element]: {
87127
- [ActionElement.Server]: "@modern-js/plugin-server"
87128
- },
87129
- [ActionType.Function]: {
87130
- [ActionFunction.TailwindCSS]: "@modern-js/plugin-tailwindcss",
87131
- [ActionFunction.BFF]: "@modern-js/plugin-bff",
87132
- [ActionFunction.MicroFrontend]: "@modern-js/plugin-garfish",
87133
- [ActionFunction.SSG]: "@modern-js/plugin-ssg",
87134
- [ActionFunction.Polyfill]: "@modern-js/plugin-polyfill",
87135
- [ActionFunction.Proxy]: "@modern-js/plugin-proxy",
87136
- [ActionFunction.SWC]: "@modern-js/plugin-swc"
87137
- },
87138
- [ActionType.Refactor]: {
87139
- [ActionRefactor.ReactRouter5]: "@modern-js/plugin-router-v5"
87140
- }
87141
- };
87142
- var BFFPluginName = {
87143
- [Framework.Express]: "expressPlugin",
87144
- [Framework.Koa]: "koaPlugin"
87145
- };
87146
- var BFFPluginDependence = {
87147
- [Framework.Express]: "@modern-js/plugin-express",
87148
- [Framework.Koa]: "@modern-js/plugin-koa"
87149
- };
87150
-
87151
- // ../../generator-common/dist/esm-node/mwa/bff.js
87152
- var BFFType;
87153
- (function(BFFType2) {
87154
- BFFType2["Func"] = "func";
87155
- BFFType2["Framework"] = "framework";
87156
- })(BFFType || (BFFType = {}));
87157
- var getBFFTypeSchema = (_extra = {}) => {
87158
- return {
87159
- type: "string",
87160
- title: i18n2.t(localeKeys2.bff.bffType.self),
87161
- enum: Object.values(BFFType).map((bffType) => ({
87162
- value: bffType,
87163
- label: i18n2.t(localeKeys2.bff.bffType[bffType])
87164
- }))
87165
- };
87166
- };
87167
- var getBFFchemaProperties = (extra) => {
87168
- return {
87169
- bffType: getBFFTypeSchema(extra),
87170
- framework: getFrameworkSchema(extra)
87171
- };
87172
- };
87173
- var getBFFSchema = (extra = {}) => {
87174
- return {
87175
- type: "object",
87176
- properties: getBFFchemaProperties(extra)
87177
- };
87178
- };
87179
- var MWADefaultBffConfig = {
87180
- bffType: "func",
87181
- frameWork: Framework.Express
87182
- };
87183
-
87184
86993
  // ../../generator-utils/dist/esm/index.js
87185
86994
  var import_path5 = __toESM(require("path"));
87186
86995
 
@@ -88491,7 +88300,6 @@ function isEmptyApiDir(apiDir) {
88491
88300
  }
88492
88301
  var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, function* () {
88493
88302
  const jsonAPI = new JsonAPI(generator);
88494
- const ans = yield appApi.getInputBySchemaFunc(getBFFSchema, context.config);
88495
88303
  const appDir = context.materials.default.basePath;
88496
88304
  const apiDir = import_path6.default.join(appDir, "api");
88497
88305
  if (import_fs_extra.default.existsSync(apiDir) && !isEmptyApiDir(apiDir)) {
@@ -88501,7 +88309,6 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
88501
88309
  throw Error("The 'api' directory is already exist");
88502
88310
  }
88503
88311
  }
88504
- const { bffType, framework } = ans;
88505
88312
  const language = isTsProject(appDir) ? Language.TS : Language.JS;
88506
88313
  const getBffPluginVersion = (packageName) => {
88507
88314
  return getModernPluginVersion(Solution.MWA, packageName, {
@@ -88510,34 +88317,18 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
88510
88317
  cwd: context.materials.default.basePath
88511
88318
  });
88512
88319
  };
88513
- context.config.bffPluginName = BFFPluginName[framework];
88514
- context.config.bffPluginDependence = BFFPluginDependence[framework];
88515
- let updateInfo = {};
88516
- if (framework === Framework.Express || framework === Framework.Koa) {
88517
- updateInfo = {
88518
- [`devDependencies.@types/${framework}`]: `~${yield getPackageVersion(`@types/${framework}`)}`
88519
- };
88520
- }
88521
- updateInfo = __spreadProps(__spreadValues({}, updateInfo), {
88522
- [`dependencies.${framework}`]: `~${yield getPackageVersion(
88523
- framework
88524
- )}`
88525
- });
88526
88320
  yield jsonAPI.update(
88527
88321
  context.materials.default.get(import_path6.default.join(appDir, "package.json")),
88528
88322
  {
88529
88323
  query: {},
88530
88324
  update: {
88531
- $set: __spreadValues({
88325
+ $set: {
88532
88326
  "dependencies.@modern-js/plugin-bff": `${yield getBffPluginVersion(
88533
88327
  "@modern-js/plugin-bff"
88534
88328
  )}`,
88535
- [`dependencies.@modern-js/plugin-${framework}`]: `${yield getBffPluginVersion(
88536
- `@modern-js/plugin-${framework}`
88537
- )}`,
88538
88329
  "devDependencies.ts-node": "~10.8.1",
88539
88330
  "devDependencies.tsconfig-paths": "~3.14.1"
88540
- }, updateInfo)
88331
+ }
88541
88332
  }
88542
88333
  },
88543
88334
  true
@@ -88559,81 +88350,24 @@ var handleTemplateFile = (context, generator, appApi) => __async(void 0, null, f
88559
88350
  );
88560
88351
  }
88561
88352
  }
88562
- if (bffType === BFFType.Func) {
88563
- if (language === Language.TS) {
88564
- yield jsonAPI.update(
88565
- context.materials.default.get(import_path6.default.join(appDir, "tsconfig.json")),
88566
- {
88567
- query: {},
88568
- update: {
88569
- $set: {
88570
- "compilerOptions.paths.@api/*": ["./api/*"]
88571
- }
88353
+ if (language === Language.TS) {
88354
+ yield jsonAPI.update(
88355
+ context.materials.default.get(import_path6.default.join(appDir, "tsconfig.json")),
88356
+ {
88357
+ query: {},
88358
+ update: {
88359
+ $set: {
88360
+ "compilerOptions.paths.@api/*": ["./api/lambda/*"]
88572
88361
  }
88573
- },
88574
- true
88575
- );
88576
- }
88577
- yield appApi.forgeTemplate(
88578
- "templates/function/base/*",
88579
- void 0,
88580
- (resourceKey) => resourceKey.replace("templates/function/base/", "api/").replace(".handlebars", `.${language}`)
88581
- );
88582
- yield appApi.forgeTemplate(
88583
- `templates/function/info/*`,
88584
- (resourceKey) => resourceKey.includes(language),
88585
- (resourceKey) => resourceKey.replace("templates/function/info/", "api/info/").replace(".handlebars", ``)
88362
+ }
88363
+ },
88364
+ true
88586
88365
  );
88587
- yield appApi.forgeTemplate(
88588
- `templates/function/app/${language}/${framework}.${language}.handlebars`,
88589
- void 0,
88590
- (resourceKey) => resourceKey.replace(
88591
- `templates/function/app/${language}/${framework}.${language}.handlebars`,
88592
- `api/_app.${language}`
88593
- )
88594
- );
88595
- } else {
88596
- if (language === Language.TS) {
88597
- yield jsonAPI.update(
88598
- context.materials.default.get(import_path6.default.join(appDir, "tsconfig.json")),
88599
- {
88600
- query: {},
88601
- update: {
88602
- $set: {
88603
- "compilerOptions.paths.@api/*": ["./api/lambda/*"]
88604
- }
88605
- }
88606
- },
88607
- true
88608
- );
88609
- }
88610
88366
  yield appApi.forgeTemplate(
88611
88367
  `templates/framework/lambda/*`,
88612
88368
  void 0,
88613
88369
  (resourceKey) => resourceKey.replace(`templates/framework/`, "api/").replace(".handlebars", `.${language}`)
88614
88370
  );
88615
- yield appApi.forgeTemplate(
88616
- `templates/framework/app/${framework}/**/*`,
88617
- (resourceKey) => framework === Framework.Koa ? resourceKey.includes(language) : true,
88618
- (resourceKey) => resourceKey.replace(`templates/framework/app/${framework}/`, "api/").replace(
88619
- ".handlebars",
88620
- framework === Framework.Express ? `.${language}` : ""
88621
- )
88622
- );
88623
- }
88624
- const appendTypeContent = FrameworkAppendTypeContent[framework];
88625
- if (appendTypeContent && language === Language.TS) {
88626
- const typePath = import_path6.default.join(appDir, "src", "modern-app-env.d.ts");
88627
- if (import_fs_extra.default.existsSync(typePath)) {
88628
- const npmrc = import_fs_extra.default.readFileSync(typePath, "utf-8");
88629
- if (!npmrc.includes(appendTypeContent)) {
88630
- import_fs_extra.default.writeFileSync(typePath, `${npmrc}${appendTypeContent}
88631
- `, "utf-8");
88632
- }
88633
- } else {
88634
- import_fs_extra.default.ensureFileSync(typePath);
88635
- import_fs_extra.default.writeFileSync(typePath, appendTypeContent, "utf-8");
88636
- }
88637
88371
  }
88638
88372
  });
88639
88373
  var src_default = (context, generator) => __async(void 0, null, function* () {
@@ -88664,13 +88398,7 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
88664
88398
  const appDir = context.materials.default.basePath;
88665
88399
  const configFile = yield getModernConfigFile(appDir);
88666
88400
  const isTS = configFile.endsWith("ts");
88667
- const {
88668
- pluginName,
88669
- bffPluginName,
88670
- pluginDependence,
88671
- bffPluginDependence,
88672
- shouldUsePluginNameExport
88673
- } = context.config;
88401
+ const { pluginName, pluginDependence, shouldUsePluginNameExport } = context.config;
88674
88402
  console.info(
88675
88403
  import_chalk.default.green(`
88676
88404
  [INFO]`),
@@ -88685,33 +88413,23 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
88685
88413
  `import { ${pluginName} } from '${pluginDependence}';`
88686
88414
  )
88687
88415
  );
88688
- console.info(
88689
- import_chalk.default.yellow.bold(
88690
- `import { ${bffPluginName} } from '${bffPluginDependence}';`
88691
- )
88692
- );
88693
88416
  } else {
88694
88417
  console.info(
88695
88418
  import_chalk.default.yellow.bold(`import ${pluginName} from '${pluginDependence}';`)
88696
88419
  );
88697
- console.info(
88698
- import_chalk.default.yellow.bold(
88699
- `import ${bffPluginName} from '${bffPluginDependence}';`
88700
- )
88701
- );
88702
88420
  }
88703
88421
  if (isTS) {
88704
88422
  console.info(`
88705
88423
  export default defineConfig({
88706
88424
  ...,
88707
- plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}(), ${bffPluginName}()`)}],
88425
+ plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}()`)}],
88708
88426
  });
88709
88427
  `);
88710
88428
  } else {
88711
88429
  console.info(`
88712
88430
  module.exports = {
88713
88431
  ...,
88714
- plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}(), ${bffPluginName}()`)}],
88432
+ plugins: [..., ${import_chalk.default.yellow.bold(`${pluginName}()`)}],
88715
88433
  };
88716
88434
  `);
88717
88435
  }
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.7.30",
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.7",
28
- "@modern-js/codesmith-api-app": "2.6.7",
29
- "@modern-js/codesmith-api-json": "2.6.7",
30
- "@modern-js/codesmith-utils": "2.6.7",
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/generator-common": "3.7.30",
36
- "@modern-js/generator-utils": "3.7.30",
37
- "@modern-js/plugin-i18n": "2.67.5",
35
+ "@modern-js/generator-common": "3.7.32",
36
+ "@modern-js/generator-utils": "3.7.32",
37
+ "@modern-js/plugin-i18n": "2.67.7",
38
38
  "@scripts/build": "2.66.0",
39
39
  "@scripts/jest-config": "2.66.0"
40
40
  },
@@ -1,9 +0,0 @@
1
- import express from 'express';
2
-
3
- const app = express();
4
- app.use(async (req, res, next) => {
5
- console.info(`access url: ${req.url}`);
6
- next();
7
- });
8
-
9
- export default app;
@@ -1,12 +0,0 @@
1
- import Koa from 'koa';
2
- import koaBody from 'koa-body';
3
-
4
- const app = new Koa();
5
- app.use(async (ctx, next) => {
6
- console.info(`access url: ${ctx.url}`);
7
- await next();
8
- });
9
-
10
- app.use(koaBody());
11
-
12
- export default app;
@@ -1,12 +0,0 @@
1
- import Koa, { Context } from 'koa';
2
- import koaBody from 'koa-body';
3
-
4
- const app = new Koa();
5
- app.use(async (ctx: Context, next) => {
6
- console.info(`access url: ${ctx.url}`);
7
- await next();
8
- });
9
-
10
- app.use(koaBody());
11
-
12
- export default app;
@@ -1,8 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
-
3
- export default hook(({ addMiddleware }) => {
4
- addMiddleware(async (req, res, next) => {
5
- console.info(`access url: ${req.url}`);
6
- next();
7
- });
8
- });
@@ -1,8 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
-
3
- export default hook(({ addMiddleware }) => {
4
- addMiddleware(async (ctx, next) => {
5
- console.info(`access url: ${ctx.url}`);
6
- await next();
7
- });
8
- });
@@ -1,9 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
- import { Request, Response, NextFunction } from 'express';
3
-
4
- export default hook(({ addMiddleware }) => {
5
- addMiddleware(async (req: Request, res: Response, next: NextFunction) => {
6
- console.info(`access url: ${req.url}`);
7
- next();
8
- });
9
- });
@@ -1,9 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
- import { Context, Next } from 'koa';
3
-
4
- export default hook(({ addMiddleware }) => {
5
- addMiddleware(async (ctx: Context, next: Next) => {
6
- console.info(`access url: ${ctx.url}`);
7
- await next();
8
- });
9
- });
@@ -1,7 +0,0 @@
1
- export default async () => ({
2
- message: 'Hello Modern.js',
3
- });
4
-
5
- export const post = async () => ({
6
- message: 'Hello Modern.js',
7
- });
@@ -1,18 +0,0 @@
1
- export default async (type, { query }) => {
2
- const { username } = query;
3
- return {
4
- type,
5
- username,
6
- message: 'Hello Modern.js',
7
- };
8
- };
9
-
10
- export const post = async (type, { query, data }) => {
11
- const { username } = query;
12
- const { message } = data;
13
- return Promise.resolve({
14
- type,
15
- username,
16
- message: `Hello Modern.js. Your message: ${message}`,
17
- });
18
- };
@@ -1,24 +0,0 @@
1
- type UserQuery = { username: string };
2
- type UserPostData = { message: string };
3
-
4
- export default async (type: string, { query }: { query: UserQuery }) => {
5
- const { username } = query;
6
- return {
7
- type,
8
- username,
9
- message: 'Hello Modern.js',
10
- };
11
- };
12
-
13
- export const post = async (
14
- type: string,
15
- { query, data }: { query: UserQuery; data: UserPostData },
16
- ) => {
17
- const { username } = query;
18
- const { message } = data;
19
- return Promise.resolve({
20
- type,
21
- username,
22
- message: `Hello Modern.js. Your message: ${message}`,
23
- });
24
- };