@modern-js/server-generator 3.1.21 → 3.1.23

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 +35 -280
  2. package/package.json +8 -7
package/dist/index.js CHANGED
@@ -35114,10 +35114,14 @@ var require_chainId = __commonJS({
35114
35114
  SVG: "svg",
35115
35115
  /** Rule for pug */
35116
35116
  PUG: "pug",
35117
+ /** Rule for Vue */
35118
+ VUE: "vue",
35117
35119
  /** Rule for toml */
35118
35120
  TOML: "toml",
35119
35121
  /** Rule for yaml */
35120
35122
  YAML: "yaml",
35123
+ /** Rule for wasm */
35124
+ WASM: "wasm",
35121
35125
  /** Rule for bff */
35122
35126
  JS_BFF_API: "js-bff-api"
35123
35127
  },
@@ -35144,6 +35148,8 @@ var require_chainId = __commonJS({
35144
35148
  URL: "url",
35145
35149
  /** pug-loader */
35146
35150
  PUG: "pug",
35151
+ /** vue-loader */
35152
+ VUE: "vue",
35147
35153
  /** file-loader */
35148
35154
  FILE: "file",
35149
35155
  /** @svgr/webpack */
@@ -35213,12 +35219,16 @@ var require_chainId = __commonJS({
35213
35219
  BUNDLE_ANALYZER: "bundle-analyze",
35214
35220
  /** BottomTemplatePlugin */
35215
35221
  BOTTOM_TEMPLATE: "bottom-template",
35216
- /** HtmlCrossOriginPlugin */
35217
- HTML_CROSS_ORIGIN: "html-cross-origin",
35222
+ /** HtmlTagsPlugin */
35223
+ HTML_TAGS: "html-tags",
35218
35224
  /** HtmlNoncePlugin */
35219
35225
  HTML_NONCE: "html-nonce",
35226
+ /** HtmlCrossOriginPlugin */
35227
+ HTML_CROSS_ORIGIN: "html-cross-origin",
35220
35228
  /** MiniCssExtractPlugin */
35221
35229
  MINI_CSS_EXTRACT: "mini-css-extract",
35230
+ /** VueLoaderPlugin */
35231
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
35222
35232
  /** ReactFastRefreshPlugin */
35223
35233
  REACT_FAST_REFRESH: "react-fast-refresh",
35224
35234
  /** ProvidePlugin for node polyfill */
@@ -35232,9 +35242,7 @@ var require_chainId = __commonJS({
35232
35242
  /** HtmlAsyncChunkPlugin */
35233
35243
  HTML_ASYNC_CHUNK: "html-async-chunk",
35234
35244
  /** SWC_POLYFILL_CHECKER */
35235
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
35236
- /** HtmlTagsPlugin */
35237
- HTML_TAGS: "html-tags"
35245
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
35238
35246
  },
35239
35247
  /** Predefined minimizers */
35240
35248
  MINIMIZER: {
@@ -35276,6 +35284,9 @@ var require_constants = __commonJS({
35276
35284
  ROUTE_SPEC_FILE: function() {
35277
35285
  return ROUTE_SPEC_FILE;
35278
35286
  },
35287
+ NESTED_ROUTE_SPEC_FILE: function() {
35288
+ return NESTED_ROUTE_SPEC_FILE;
35289
+ },
35279
35290
  MAIN_ENTRY_NAME: function() {
35280
35291
  return MAIN_ENTRY_NAME;
35281
35292
  },
@@ -35360,9 +35371,6 @@ var require_constants = __commonJS({
35360
35371
  INTERNAL_SERVER_PLUGINS: function() {
35361
35372
  return INTERNAL_SERVER_PLUGINS;
35362
35373
  },
35363
- PLUGIN_SCHEMAS: function() {
35364
- return PLUGIN_SCHEMAS;
35365
- },
35366
35374
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
35367
35375
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
35368
35376
  }
@@ -35370,6 +35378,7 @@ var require_constants = __commonJS({
35370
35378
  var _export_star = require_export_star();
35371
35379
  _export_star._(require_chainId(), exports);
35372
35380
  var ROUTE_SPEC_FILE = "route.json";
35381
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
35373
35382
  var MAIN_ENTRY_NAME = "main";
35374
35383
  var SERVER_BUNDLE_DIRECTORY = "bundles";
35375
35384
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -35416,8 +35425,6 @@ var require_constants = __commonJS({
35416
35425
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
35417
35426
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
35418
35427
  "@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
35428
  // legacy router (inner react-router-dom v5)
35422
35429
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
35423
35430
  };
@@ -35448,8 +35455,6 @@ var require_constants = __commonJS({
35448
35455
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
35449
35456
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
35450
35457
  "@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
35458
  // legacy router (inner react-router-dom v5)
35454
35459
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
35455
35460
  };
@@ -35465,214 +35470,6 @@ var require_constants = __commonJS({
35465
35470
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
35466
35471
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
35467
35472
  };
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
35473
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
35677
35474
  allowNamespaces: true,
35678
35475
  allExtensions: true,
@@ -36102,6 +35899,7 @@ var require_project = __commonJS({
36102
35899
  });
36103
35900
  var _interop_require_default = require_interop_require_default();
36104
35901
  var _path = /* @__PURE__ */ _interop_require_default._(require("path"));
35902
+ var _pkgup = /* @__PURE__ */ _interop_require_default._(require_pkg_up());
36105
35903
  var _commands = require_commands();
36106
35904
  var _compiled = require_compiled();
36107
35905
  var _common = require_common();
@@ -36127,19 +35925,24 @@ var require_project = __commonJS({
36127
35925
  return false;
36128
35926
  }
36129
35927
  };
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);
35928
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
35929
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
35930
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
36133
35931
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
36134
- return !existSrc || Boolean(options["api-only"]);
35932
+ if (options["api-only"]) {
35933
+ return true;
35934
+ }
35935
+ return existApi && !existSrc;
36135
35936
  });
36136
35937
  var isWebOnly = () => __async(exports, null, function* () {
36137
35938
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
36138
35939
  return Boolean(options["web-only"]);
36139
35940
  });
36140
35941
  var isBeyondReact17 = (cwd) => {
36141
- const pkgPath = _path.default.join(cwd, "package.json");
36142
- if (!_compiled.fs.existsSync(pkgPath)) {
35942
+ const pkgPath = _pkgup.default.sync({
35943
+ cwd
35944
+ });
35945
+ if (!pkgPath) {
36143
35946
  return false;
36144
35947
  }
36145
35948
  const pkgInfo = JSON.parse(_compiled.fs.readFileSync(pkgPath, "utf8"));
@@ -36465,21 +36268,6 @@ var require_get = __commonJS({
36465
36268
  }
36466
36269
  });
36467
36270
 
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
36271
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
36484
36272
  var require_logger = __commonJS({
36485
36273
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -36502,7 +36290,6 @@ var require_logger = __commonJS({
36502
36290
  return logger2;
36503
36291
  }
36504
36292
  });
36505
- var _define_property15 = require_define_property();
36506
36293
  var _interop_require_default = require_interop_require_default();
36507
36294
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk());
36508
36295
  var LOG_LEVEL = {
@@ -36588,10 +36375,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
36588
36375
  return longestLabel;
36589
36376
  }
36590
36377
  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
36378
  this.level = options.level || LOG_TYPES.log.level;
36596
36379
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
36597
36380
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -37521,31 +37304,6 @@ var require_runtimeExports = __commonJS({
37521
37304
  }
37522
37305
  });
37523
37306
 
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
37307
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
37550
37308
  var require_watch = __commonJS({
37551
37309
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -37642,7 +37400,6 @@ var require_cli = __commonJS({
37642
37400
  _export_star._(require_require(), exports);
37643
37401
  _export_star._(require_routes(), exports);
37644
37402
  _export_star._(require_runtimeExports(), exports);
37645
- _export_star._(require_test(), exports);
37646
37403
  _export_star._(require_watch(), exports);
37647
37404
  }
37648
37405
  });
@@ -74169,7 +73926,7 @@ var require_parse = __commonJS({
74169
73926
  return current.type === "Punctuator" ? current.value : current.type;
74170
73927
  };
74171
73928
  var is = (t) => type() === t;
74172
- var expect2 = (a) => {
73929
+ var expect = (a) => {
74173
73930
  if (!is(a)) {
74174
73931
  unexpected();
74175
73932
  }
@@ -74251,7 +74008,7 @@ var require_parse = __commonJS({
74251
74008
  while (!is(CURLY_BRACKET_CLOSE)) {
74252
74009
  if (started) {
74253
74010
  assign_comments(PREFIX_AFTER_VALUE);
74254
- expect2(COMMA);
74011
+ expect(COMMA);
74255
74012
  next();
74256
74013
  parse_comments();
74257
74014
  assign_after_comments();
@@ -74260,13 +74017,13 @@ var require_parse = __commonJS({
74260
74017
  }
74261
74018
  }
74262
74019
  started = true;
74263
- expect2("String");
74020
+ expect("String");
74264
74021
  name = JSON.parse(current.value);
74265
74022
  set_prop(name);
74266
74023
  assign_comments(PREFIX_BEFORE);
74267
74024
  next();
74268
74025
  parse_comments(PREFIX_AFTER_PROP);
74269
- expect2(COLON);
74026
+ expect(COLON);
74270
74027
  next();
74271
74028
  parse_comments(PREFIX_AFTER_COLON);
74272
74029
  obj[name] = transform(name, walk());
@@ -74294,7 +74051,7 @@ var require_parse = __commonJS({
74294
74051
  while (!is(BRACKET_CLOSE)) {
74295
74052
  if (started) {
74296
74053
  assign_comments(PREFIX_AFTER_VALUE);
74297
- expect2(COMMA);
74054
+ expect(COMMA);
74298
74055
  next();
74299
74056
  parse_comments();
74300
74057
  assign_after_comments();
@@ -117994,7 +117751,7 @@ var ZH_LOCALE = {
117994
117751
  function: {
117995
117752
  self: "启用可选功能",
117996
117753
  question: "请选择功能名称",
117997
- tailwindcss: "启用 「Tailwind CSS」 支持",
117754
+ tailwindcss: "启用「Tailwind CSS」 支持",
117998
117755
  bff: "启用「BFF」功能",
117999
117756
  micro_frontend: "启用「微前端」模式",
118000
117757
  i18n: "启用「国际化(i18n)」功能",
@@ -133767,8 +133524,6 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
133767
133524
  yield handleTemplateFile(context, generator, appApi);
133768
133525
  generator.logger.debug(`forge @modern-js/server-generator succeed `);
133769
133526
  });
133770
- // Annotate the CommonJS export names for ESM import in node:
133771
- 0 && (module.exports = {});
133772
133527
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
133773
133528
  /*!
133774
133529
  * 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.23",
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.23",
35
+ "@modern-js/generator-utils": "3.1.23",
36
+ "@modern-js/dependence-generator": "3.1.23",
37
+ "@scripts/build": "2.23.1",
38
+ "@scripts/jest-config": "2.23.1"
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",