@modern-js/server-generator 3.1.21 → 3.1.22

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -273
  2. package/package.json +8 -7
package/dist/index.js CHANGED
@@ -35276,6 +35276,9 @@ var require_constants = __commonJS({
35276
35276
  ROUTE_SPEC_FILE: function() {
35277
35277
  return ROUTE_SPEC_FILE;
35278
35278
  },
35279
+ NESTED_ROUTE_SPEC_FILE: function() {
35280
+ return NESTED_ROUTE_SPEC_FILE;
35281
+ },
35279
35282
  MAIN_ENTRY_NAME: function() {
35280
35283
  return MAIN_ENTRY_NAME;
35281
35284
  },
@@ -35360,9 +35363,6 @@ var require_constants = __commonJS({
35360
35363
  INTERNAL_SERVER_PLUGINS: function() {
35361
35364
  return INTERNAL_SERVER_PLUGINS;
35362
35365
  },
35363
- PLUGIN_SCHEMAS: function() {
35364
- return PLUGIN_SCHEMAS;
35365
- },
35366
35366
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
35367
35367
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
35368
35368
  }
@@ -35370,6 +35370,7 @@ var require_constants = __commonJS({
35370
35370
  var _export_star = require_export_star();
35371
35371
  _export_star._(require_chainId(), exports);
35372
35372
  var ROUTE_SPEC_FILE = "route.json";
35373
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
35373
35374
  var MAIN_ENTRY_NAME = "main";
35374
35375
  var SERVER_BUNDLE_DIRECTORY = "bundles";
35375
35376
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -35416,8 +35417,6 @@ var require_constants = __commonJS({
35416
35417
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
35417
35418
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
35418
35419
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
35419
- // TODO: Maybe can remove it
35420
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
35421
35420
  // legacy router (inner react-router-dom v5)
35422
35421
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
35423
35422
  };
@@ -35448,8 +35447,6 @@ var require_constants = __commonJS({
35448
35447
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
35449
35448
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
35450
35449
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
35451
- // TODO: Maybe can remove it
35452
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
35453
35450
  // legacy router (inner react-router-dom v5)
35454
35451
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
35455
35452
  };
@@ -35465,214 +35462,6 @@ var require_constants = __commonJS({
35465
35462
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
35466
35463
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
35467
35464
  };
35468
- var PLUGIN_SCHEMAS = {
35469
- "@modern-js/runtime": [
35470
- {
35471
- target: "runtime",
35472
- schema: {
35473
- type: "object",
35474
- additionalProperties: false
35475
- }
35476
- },
35477
- {
35478
- target: "runtimeByEntries",
35479
- schema: {
35480
- type: "object",
35481
- patternProperties: {
35482
- [ENTRY_NAME_PATTERN]: {
35483
- type: "object"
35484
- }
35485
- },
35486
- additionalProperties: false
35487
- }
35488
- }
35489
- ],
35490
- "@modern-js/plugin-swc": [
35491
- {
35492
- target: "tools.swc",
35493
- schema: {
35494
- typeof: [
35495
- "object"
35496
- ]
35497
- }
35498
- }
35499
- ],
35500
- "@modern-js/plugin-bff": [
35501
- {
35502
- target: "bff",
35503
- schema: {
35504
- type: "object",
35505
- properties: {
35506
- prefix: {
35507
- type: [
35508
- "string",
35509
- "array"
35510
- ],
35511
- items: {
35512
- type: "string"
35513
- }
35514
- },
35515
- fetcher: {
35516
- type: "string"
35517
- },
35518
- proxy: {
35519
- type: "object"
35520
- },
35521
- requestCreator: {
35522
- type: "string"
35523
- }
35524
- }
35525
- }
35526
- }
35527
- ],
35528
- "@modern-js/plugin-tailwindcss": [
35529
- {
35530
- target: "tools.tailwindcss",
35531
- schema: {
35532
- typeof: [
35533
- "object",
35534
- "function"
35535
- ]
35536
- }
35537
- }
35538
- ],
35539
- "@modern-js/plugin-proxy": [
35540
- {
35541
- target: "dev.proxy",
35542
- schema: {
35543
- typeof: [
35544
- "string",
35545
- "object"
35546
- ]
35547
- }
35548
- }
35549
- ],
35550
- "@modern-js/plugin-ssg": [
35551
- {
35552
- target: "output.ssg",
35553
- schema: {
35554
- oneOf: [
35555
- {
35556
- type: "boolean"
35557
- },
35558
- {
35559
- type: "object"
35560
- },
35561
- {
35562
- instanceof: "Function"
35563
- }
35564
- ]
35565
- }
35566
- }
35567
- ],
35568
- "@modern-js/plugin-state": [
35569
- {
35570
- target: "runtime.state",
35571
- schema: {
35572
- type: [
35573
- "boolean",
35574
- "object"
35575
- ]
35576
- }
35577
- }
35578
- ],
35579
- "@modern-js/plugin-design-token": [
35580
- // Legacy Features
35581
- {
35582
- target: "source.designSystem",
35583
- schema: {
35584
- typeof: [
35585
- "object"
35586
- ]
35587
- }
35588
- },
35589
- {
35590
- target: "source.designSystem.supportStyledComponents",
35591
- schema: {
35592
- type: [
35593
- "boolean"
35594
- ]
35595
- }
35596
- },
35597
- {
35598
- target: "designSystem",
35599
- schema: {
35600
- typeof: [
35601
- "object"
35602
- ]
35603
- }
35604
- }
35605
- ],
35606
- "@modern-js/plugin-router": [
35607
- {
35608
- target: "runtime.router",
35609
- schema: {
35610
- type: [
35611
- "boolean",
35612
- "object"
35613
- ]
35614
- }
35615
- }
35616
- ],
35617
- "@modern-js/plugin-testing": [
35618
- {
35619
- target: "testing",
35620
- schema: {
35621
- typeof: [
35622
- "object"
35623
- ]
35624
- }
35625
- },
35626
- {
35627
- target: "tools.jest",
35628
- schema: {
35629
- typeof: [
35630
- "object",
35631
- "function"
35632
- ]
35633
- }
35634
- }
35635
- ],
35636
- "@modern-js/plugin-garfish": [
35637
- {
35638
- target: "runtime.masterApp",
35639
- schema: {
35640
- type: [
35641
- "boolean",
35642
- "object"
35643
- ]
35644
- }
35645
- },
35646
- {
35647
- target: "dev.withMasterApp",
35648
- schema: {
35649
- type: [
35650
- "object"
35651
- ]
35652
- }
35653
- },
35654
- {
35655
- target: "deploy.microFrontend",
35656
- schema: {
35657
- type: [
35658
- "boolean",
35659
- "object"
35660
- ]
35661
- }
35662
- }
35663
- ],
35664
- "@modern-js/plugin-nocode": [],
35665
- "@modern-js/plugin-worker": [
35666
- {
35667
- target: "deploy.worker.ssr",
35668
- schema: {
35669
- type: [
35670
- "boolean"
35671
- ]
35672
- }
35673
- }
35674
- ]
35675
- };
35676
35465
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
35677
35466
  allowNamespaces: true,
35678
35467
  allExtensions: true,
@@ -36127,11 +35916,14 @@ var require_project = __commonJS({
36127
35916
  return false;
36128
35917
  }
36129
35918
  };
36130
- var isApiOnly = (appDirectory, entryDir) => __async(exports, null, function* () {
36131
- const srcDir = _path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
36132
- const existSrc = yield _compiled.fs.pathExists(srcDir);
35919
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
35920
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
35921
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
36133
35922
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
36134
- return !existSrc || Boolean(options["api-only"]);
35923
+ if (options["api-only"]) {
35924
+ return true;
35925
+ }
35926
+ return existApi && !existSrc;
36135
35927
  });
36136
35928
  var isWebOnly = () => __async(exports, null, function* () {
36137
35929
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
@@ -36465,21 +36257,6 @@ var require_get = __commonJS({
36465
36257
  }
36466
36258
  });
36467
36259
 
36468
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs
36469
- var require_define_property = __commonJS({
36470
- "../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs"(exports) {
36471
- "use strict";
36472
- exports._ = exports._define_property = _define_property15;
36473
- function _define_property15(obj, key, value) {
36474
- if (key in obj) {
36475
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
36476
- } else
36477
- obj[key] = value;
36478
- return obj;
36479
- }
36480
- }
36481
- });
36482
-
36483
36260
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
36484
36261
  var require_logger = __commonJS({
36485
36262
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -36502,7 +36279,6 @@ var require_logger = __commonJS({
36502
36279
  return logger2;
36503
36280
  }
36504
36281
  });
36505
- var _define_property15 = require_define_property();
36506
36282
  var _interop_require_default = require_interop_require_default();
36507
36283
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk());
36508
36284
  var LOG_LEVEL = {
@@ -36588,10 +36364,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
36588
36364
  return longestLabel;
36589
36365
  }
36590
36366
  constructor(options = {}) {
36591
- _define_property15._(this, "level", void 0);
36592
- _define_property15._(this, "config", void 0);
36593
- _define_property15._(this, "types", void 0);
36594
- _define_property15._(this, "longestLabel", void 0);
36595
36367
  this.level = options.level || LOG_TYPES.log.level;
36596
36368
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
36597
36369
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -37521,31 +37293,6 @@ var require_runtimeExports = __commonJS({
37521
37293
  }
37522
37294
  });
37523
37295
 
37524
- // ../../../toolkit/utils/dist/cjs/cli/test.js
37525
- var require_test = __commonJS({
37526
- "../../../toolkit/utils/dist/cjs/cli/test.js"(exports) {
37527
- "use strict";
37528
- Object.defineProperty(exports, "__esModule", {
37529
- value: true
37530
- });
37531
- Object.defineProperty(exports, "initSnapshotSerializer", {
37532
- enumerable: true,
37533
- get: function() {
37534
- return initSnapshotSerializer;
37535
- }
37536
- });
37537
- var initSnapshotSerializer = (root) => {
37538
- expect.addSnapshotSerializer({
37539
- test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
37540
- print: (val) => (
37541
- // eslint-disable-next-line no-nested-ternary
37542
- typeof val === "string" ? val.includes("node_modules") ? `"${val.replace(/.+node_modules/, ``).replace(/\\/g, "/")}"` : val.includes("modern.js") ? `"${val.replace(/.+modern\.js/, ``).replace(/\\/g, "/")}"` : `"${val.replace(root, "").replace(/\\/g, "/")}"` : val
37543
- )
37544
- });
37545
- };
37546
- }
37547
- });
37548
-
37549
37296
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
37550
37297
  var require_watch = __commonJS({
37551
37298
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -37642,7 +37389,6 @@ var require_cli = __commonJS({
37642
37389
  _export_star._(require_require(), exports);
37643
37390
  _export_star._(require_routes(), exports);
37644
37391
  _export_star._(require_runtimeExports(), exports);
37645
- _export_star._(require_test(), exports);
37646
37392
  _export_star._(require_watch(), exports);
37647
37393
  }
37648
37394
  });
@@ -74169,7 +73915,7 @@ var require_parse = __commonJS({
74169
73915
  return current.type === "Punctuator" ? current.value : current.type;
74170
73916
  };
74171
73917
  var is = (t) => type() === t;
74172
- var expect2 = (a) => {
73918
+ var expect = (a) => {
74173
73919
  if (!is(a)) {
74174
73920
  unexpected();
74175
73921
  }
@@ -74251,7 +73997,7 @@ var require_parse = __commonJS({
74251
73997
  while (!is(CURLY_BRACKET_CLOSE)) {
74252
73998
  if (started) {
74253
73999
  assign_comments(PREFIX_AFTER_VALUE);
74254
- expect2(COMMA);
74000
+ expect(COMMA);
74255
74001
  next();
74256
74002
  parse_comments();
74257
74003
  assign_after_comments();
@@ -74260,13 +74006,13 @@ var require_parse = __commonJS({
74260
74006
  }
74261
74007
  }
74262
74008
  started = true;
74263
- expect2("String");
74009
+ expect("String");
74264
74010
  name = JSON.parse(current.value);
74265
74011
  set_prop(name);
74266
74012
  assign_comments(PREFIX_BEFORE);
74267
74013
  next();
74268
74014
  parse_comments(PREFIX_AFTER_PROP);
74269
- expect2(COLON);
74015
+ expect(COLON);
74270
74016
  next();
74271
74017
  parse_comments(PREFIX_AFTER_COLON);
74272
74018
  obj[name] = transform(name, walk());
@@ -74294,7 +74040,7 @@ var require_parse = __commonJS({
74294
74040
  while (!is(BRACKET_CLOSE)) {
74295
74041
  if (started) {
74296
74042
  assign_comments(PREFIX_AFTER_VALUE);
74297
- expect2(COMMA);
74043
+ expect(COMMA);
74298
74044
  next();
74299
74045
  parse_comments();
74300
74046
  assign_after_comments();
@@ -117994,7 +117740,7 @@ var ZH_LOCALE = {
117994
117740
  function: {
117995
117741
  self: "启用可选功能",
117996
117742
  question: "请选择功能名称",
117997
- tailwindcss: "启用 「Tailwind CSS」 支持",
117743
+ tailwindcss: "启用「Tailwind CSS」 支持",
117998
117744
  bff: "启用「BFF」功能",
117999
117745
  micro_frontend: "启用「微前端」模式",
118000
117746
  i18n: "启用「国际化(i18n)」功能",
@@ -133767,8 +133513,6 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
133767
133513
  yield handleTemplateFile(context, generator, appApi);
133768
133514
  generator.logger.debug(`forge @modern-js/server-generator succeed `);
133769
133515
  });
133770
- // Annotate the CommonJS export names for ESM import in node:
133771
- 0 && (module.exports = {});
133772
133516
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
133773
133517
  /*!
133774
133518
  * fill-range <https://github.com/jonschlinkert/fill-range>
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "3.1.21",
18
+ "version": "3.1.22",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./src/index.ts",
21
21
  "main": "./dist/index.js",
@@ -31,16 +31,17 @@
31
31
  "@types/node": "^14",
32
32
  "jest": "^29",
33
33
  "typescript": "^5",
34
- "@modern-js/generator-common": "3.1.21",
35
- "@modern-js/dependence-generator": "3.1.21",
36
- "@modern-js/generator-utils": "3.1.21",
37
- "@scripts/build": "2.22.1",
38
- "@scripts/jest-config": "2.22.1"
34
+ "@modern-js/generator-common": "3.1.22",
35
+ "@scripts/jest-config": "2.23.0",
36
+ "@modern-js/dependence-generator": "3.1.22",
37
+ "@scripts/build": "2.23.0",
38
+ "@modern-js/generator-utils": "3.1.22"
39
39
  },
40
40
  "sideEffects": false,
41
41
  "publishConfig": {
42
42
  "registry": "https://registry.npmjs.org/",
43
- "access": "public"
43
+ "access": "public",
44
+ "provenance": true
44
45
  },
45
46
  "scripts": {
46
47
  "new": "modern-lib new",