@modern-js/upgrade-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 -271
  2. package/package.json +8 -7
package/dist/index.js CHANGED
@@ -42240,7 +42240,7 @@ var require_parse = __commonJS({
42240
42240
  return current.type === "Punctuator" ? current.value : current.type;
42241
42241
  };
42242
42242
  var is = (t) => type() === t;
42243
- var expect2 = (a) => {
42243
+ var expect = (a) => {
42244
42244
  if (!is(a)) {
42245
42245
  unexpected();
42246
42246
  }
@@ -42322,7 +42322,7 @@ var require_parse = __commonJS({
42322
42322
  while (!is(CURLY_BRACKET_CLOSE)) {
42323
42323
  if (started) {
42324
42324
  assign_comments(PREFIX_AFTER_VALUE);
42325
- expect2(COMMA);
42325
+ expect(COMMA);
42326
42326
  next();
42327
42327
  parse_comments();
42328
42328
  assign_after_comments();
@@ -42331,13 +42331,13 @@ var require_parse = __commonJS({
42331
42331
  }
42332
42332
  }
42333
42333
  started = true;
42334
- expect2("String");
42334
+ expect("String");
42335
42335
  name = JSON.parse(current.value);
42336
42336
  set_prop(name);
42337
42337
  assign_comments(PREFIX_BEFORE);
42338
42338
  next();
42339
42339
  parse_comments(PREFIX_AFTER_PROP);
42340
- expect2(COLON);
42340
+ expect(COLON);
42341
42341
  next();
42342
42342
  parse_comments(PREFIX_AFTER_COLON);
42343
42343
  obj[name] = transform(name, walk());
@@ -42365,7 +42365,7 @@ var require_parse = __commonJS({
42365
42365
  while (!is(BRACKET_CLOSE)) {
42366
42366
  if (started) {
42367
42367
  assign_comments(PREFIX_AFTER_VALUE);
42368
- expect2(COMMA);
42368
+ expect(COMMA);
42369
42369
  next();
42370
42370
  parse_comments();
42371
42371
  assign_after_comments();
@@ -115492,6 +115492,9 @@ var require_constants = __commonJS({
115492
115492
  ROUTE_SPEC_FILE: function() {
115493
115493
  return ROUTE_SPEC_FILE;
115494
115494
  },
115495
+ NESTED_ROUTE_SPEC_FILE: function() {
115496
+ return NESTED_ROUTE_SPEC_FILE;
115497
+ },
115495
115498
  MAIN_ENTRY_NAME: function() {
115496
115499
  return MAIN_ENTRY_NAME;
115497
115500
  },
@@ -115576,9 +115579,6 @@ var require_constants = __commonJS({
115576
115579
  INTERNAL_SERVER_PLUGINS: function() {
115577
115580
  return INTERNAL_SERVER_PLUGINS;
115578
115581
  },
115579
- PLUGIN_SCHEMAS: function() {
115580
- return PLUGIN_SCHEMAS;
115581
- },
115582
115582
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
115583
115583
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
115584
115584
  }
@@ -115586,6 +115586,7 @@ var require_constants = __commonJS({
115586
115586
  var _export_star = require_export_star();
115587
115587
  _export_star._(require_chainId(), exports);
115588
115588
  var ROUTE_SPEC_FILE = "route.json";
115589
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
115589
115590
  var MAIN_ENTRY_NAME = "main";
115590
115591
  var SERVER_BUNDLE_DIRECTORY = "bundles";
115591
115592
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -115632,8 +115633,6 @@ var require_constants = __commonJS({
115632
115633
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
115633
115634
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
115634
115635
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
115635
- // TODO: Maybe can remove it
115636
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
115637
115636
  // legacy router (inner react-router-dom v5)
115638
115637
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
115639
115638
  };
@@ -115664,8 +115663,6 @@ var require_constants = __commonJS({
115664
115663
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
115665
115664
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
115666
115665
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
115667
- // TODO: Maybe can remove it
115668
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
115669
115666
  // legacy router (inner react-router-dom v5)
115670
115667
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
115671
115668
  };
@@ -115681,214 +115678,6 @@ var require_constants = __commonJS({
115681
115678
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
115682
115679
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
115683
115680
  };
115684
- var PLUGIN_SCHEMAS = {
115685
- "@modern-js/runtime": [
115686
- {
115687
- target: "runtime",
115688
- schema: {
115689
- type: "object",
115690
- additionalProperties: false
115691
- }
115692
- },
115693
- {
115694
- target: "runtimeByEntries",
115695
- schema: {
115696
- type: "object",
115697
- patternProperties: {
115698
- [ENTRY_NAME_PATTERN]: {
115699
- type: "object"
115700
- }
115701
- },
115702
- additionalProperties: false
115703
- }
115704
- }
115705
- ],
115706
- "@modern-js/plugin-swc": [
115707
- {
115708
- target: "tools.swc",
115709
- schema: {
115710
- typeof: [
115711
- "object"
115712
- ]
115713
- }
115714
- }
115715
- ],
115716
- "@modern-js/plugin-bff": [
115717
- {
115718
- target: "bff",
115719
- schema: {
115720
- type: "object",
115721
- properties: {
115722
- prefix: {
115723
- type: [
115724
- "string",
115725
- "array"
115726
- ],
115727
- items: {
115728
- type: "string"
115729
- }
115730
- },
115731
- fetcher: {
115732
- type: "string"
115733
- },
115734
- proxy: {
115735
- type: "object"
115736
- },
115737
- requestCreator: {
115738
- type: "string"
115739
- }
115740
- }
115741
- }
115742
- }
115743
- ],
115744
- "@modern-js/plugin-tailwindcss": [
115745
- {
115746
- target: "tools.tailwindcss",
115747
- schema: {
115748
- typeof: [
115749
- "object",
115750
- "function"
115751
- ]
115752
- }
115753
- }
115754
- ],
115755
- "@modern-js/plugin-proxy": [
115756
- {
115757
- target: "dev.proxy",
115758
- schema: {
115759
- typeof: [
115760
- "string",
115761
- "object"
115762
- ]
115763
- }
115764
- }
115765
- ],
115766
- "@modern-js/plugin-ssg": [
115767
- {
115768
- target: "output.ssg",
115769
- schema: {
115770
- oneOf: [
115771
- {
115772
- type: "boolean"
115773
- },
115774
- {
115775
- type: "object"
115776
- },
115777
- {
115778
- instanceof: "Function"
115779
- }
115780
- ]
115781
- }
115782
- }
115783
- ],
115784
- "@modern-js/plugin-state": [
115785
- {
115786
- target: "runtime.state",
115787
- schema: {
115788
- type: [
115789
- "boolean",
115790
- "object"
115791
- ]
115792
- }
115793
- }
115794
- ],
115795
- "@modern-js/plugin-design-token": [
115796
- // Legacy Features
115797
- {
115798
- target: "source.designSystem",
115799
- schema: {
115800
- typeof: [
115801
- "object"
115802
- ]
115803
- }
115804
- },
115805
- {
115806
- target: "source.designSystem.supportStyledComponents",
115807
- schema: {
115808
- type: [
115809
- "boolean"
115810
- ]
115811
- }
115812
- },
115813
- {
115814
- target: "designSystem",
115815
- schema: {
115816
- typeof: [
115817
- "object"
115818
- ]
115819
- }
115820
- }
115821
- ],
115822
- "@modern-js/plugin-router": [
115823
- {
115824
- target: "runtime.router",
115825
- schema: {
115826
- type: [
115827
- "boolean",
115828
- "object"
115829
- ]
115830
- }
115831
- }
115832
- ],
115833
- "@modern-js/plugin-testing": [
115834
- {
115835
- target: "testing",
115836
- schema: {
115837
- typeof: [
115838
- "object"
115839
- ]
115840
- }
115841
- },
115842
- {
115843
- target: "tools.jest",
115844
- schema: {
115845
- typeof: [
115846
- "object",
115847
- "function"
115848
- ]
115849
- }
115850
- }
115851
- ],
115852
- "@modern-js/plugin-garfish": [
115853
- {
115854
- target: "runtime.masterApp",
115855
- schema: {
115856
- type: [
115857
- "boolean",
115858
- "object"
115859
- ]
115860
- }
115861
- },
115862
- {
115863
- target: "dev.withMasterApp",
115864
- schema: {
115865
- type: [
115866
- "object"
115867
- ]
115868
- }
115869
- },
115870
- {
115871
- target: "deploy.microFrontend",
115872
- schema: {
115873
- type: [
115874
- "boolean",
115875
- "object"
115876
- ]
115877
- }
115878
- }
115879
- ],
115880
- "@modern-js/plugin-nocode": [],
115881
- "@modern-js/plugin-worker": [
115882
- {
115883
- target: "deploy.worker.ssr",
115884
- schema: {
115885
- type: [
115886
- "boolean"
115887
- ]
115888
- }
115889
- }
115890
- ]
115891
- };
115892
115681
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
115893
115682
  allowNamespaces: true,
115894
115683
  allExtensions: true,
@@ -116343,11 +116132,14 @@ var require_project = __commonJS({
116343
116132
  return false;
116344
116133
  }
116345
116134
  };
116346
- var isApiOnly = (appDirectory, entryDir) => __async(exports, null, function* () {
116347
- const srcDir = _path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
116348
- const existSrc = yield _compiled.fs.pathExists(srcDir);
116135
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
116136
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
116137
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
116349
116138
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
116350
- return !existSrc || Boolean(options["api-only"]);
116139
+ if (options["api-only"]) {
116140
+ return true;
116141
+ }
116142
+ return existApi && !existSrc;
116351
116143
  });
116352
116144
  var isWebOnly = () => __async(exports, null, function* () {
116353
116145
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
@@ -116681,21 +116473,6 @@ var require_get2 = __commonJS({
116681
116473
  }
116682
116474
  });
116683
116475
 
116684
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs
116685
- var require_define_property = __commonJS({
116686
- "../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs"(exports) {
116687
- "use strict";
116688
- exports._ = exports._define_property = _define_property15;
116689
- function _define_property15(obj, key, value) {
116690
- if (key in obj) {
116691
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
116692
- } else
116693
- obj[key] = value;
116694
- return obj;
116695
- }
116696
- }
116697
- });
116698
-
116699
116476
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
116700
116477
  var require_logger2 = __commonJS({
116701
116478
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -116718,7 +116495,6 @@ var require_logger2 = __commonJS({
116718
116495
  return logger2;
116719
116496
  }
116720
116497
  });
116721
- var _define_property15 = require_define_property();
116722
116498
  var _interop_require_default = require_interop_require_default();
116723
116499
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
116724
116500
  var LOG_LEVEL = {
@@ -116804,10 +116580,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
116804
116580
  return longestLabel;
116805
116581
  }
116806
116582
  constructor(options = {}) {
116807
- _define_property15._(this, "level", void 0);
116808
- _define_property15._(this, "config", void 0);
116809
- _define_property15._(this, "types", void 0);
116810
- _define_property15._(this, "longestLabel", void 0);
116811
116583
  this.level = options.level || LOG_TYPES.log.level;
116812
116584
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
116813
116585
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -117737,31 +117509,6 @@ var require_runtimeExports = __commonJS({
117737
117509
  }
117738
117510
  });
117739
117511
 
117740
- // ../../../toolkit/utils/dist/cjs/cli/test.js
117741
- var require_test = __commonJS({
117742
- "../../../toolkit/utils/dist/cjs/cli/test.js"(exports) {
117743
- "use strict";
117744
- Object.defineProperty(exports, "__esModule", {
117745
- value: true
117746
- });
117747
- Object.defineProperty(exports, "initSnapshotSerializer", {
117748
- enumerable: true,
117749
- get: function() {
117750
- return initSnapshotSerializer;
117751
- }
117752
- });
117753
- var initSnapshotSerializer = (root) => {
117754
- expect.addSnapshotSerializer({
117755
- test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
117756
- print: (val) => (
117757
- // eslint-disable-next-line no-nested-ternary
117758
- 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
117759
- )
117760
- });
117761
- };
117762
- }
117763
- });
117764
-
117765
117512
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
117766
117513
  var require_watch = __commonJS({
117767
117514
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -117858,7 +117605,6 @@ var require_cli = __commonJS({
117858
117605
  _export_star._(require_require(), exports);
117859
117606
  _export_star._(require_routes(), exports);
117860
117607
  _export_star._(require_runtimeExports(), exports);
117861
- _export_star._(require_test(), exports);
117862
117608
  _export_star._(require_watch(), exports);
117863
117609
  }
117864
117610
  });
@@ -133268,7 +133014,7 @@ var ZH_LOCALE2 = {
133268
133014
  function: {
133269
133015
  self: "启用可选功能",
133270
133016
  question: "请选择功能名称",
133271
- tailwindcss: "启用 「Tailwind CSS」 支持",
133017
+ tailwindcss: "启用「Tailwind CSS」 支持",
133272
133018
  bff: "启用「BFF」功能",
133273
133019
  micro_frontend: "启用「微前端」模式",
133274
133020
  i18n: "启用「国际化(i18n)」功能",
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
  "main": "./dist/index.js",
21
21
  "files": [
@@ -30,16 +30,17 @@
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@scripts/build": "2.22.1",
34
- "@scripts/jest-config": "2.22.1",
35
- "@modern-js/generator-utils": "3.1.21",
36
- "@modern-js/plugin-i18n": "2.22.1",
37
- "@modern-js/generator-common": "3.1.21"
33
+ "@modern-js/plugin-i18n": "2.23.0",
34
+ "@scripts/jest-config": "2.23.0",
35
+ "@modern-js/generator-utils": "3.1.22",
36
+ "@scripts/build": "2.23.0",
37
+ "@modern-js/generator-common": "3.1.22"
38
38
  },
39
39
  "sideEffects": false,
40
40
  "publishConfig": {
41
41
  "registry": "https://registry.npmjs.org/",
42
- "access": "public"
42
+ "access": "public",
43
+ "provenance": true
43
44
  },
44
45
  "types": "./src/index.ts",
45
46
  "scripts": {