@modern-js/upgrade-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 -278
  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();
@@ -115330,10 +115330,14 @@ var require_chainId = __commonJS({
115330
115330
  SVG: "svg",
115331
115331
  /** Rule for pug */
115332
115332
  PUG: "pug",
115333
+ /** Rule for Vue */
115334
+ VUE: "vue",
115333
115335
  /** Rule for toml */
115334
115336
  TOML: "toml",
115335
115337
  /** Rule for yaml */
115336
115338
  YAML: "yaml",
115339
+ /** Rule for wasm */
115340
+ WASM: "wasm",
115337
115341
  /** Rule for bff */
115338
115342
  JS_BFF_API: "js-bff-api"
115339
115343
  },
@@ -115360,6 +115364,8 @@ var require_chainId = __commonJS({
115360
115364
  URL: "url",
115361
115365
  /** pug-loader */
115362
115366
  PUG: "pug",
115367
+ /** vue-loader */
115368
+ VUE: "vue",
115363
115369
  /** file-loader */
115364
115370
  FILE: "file",
115365
115371
  /** @svgr/webpack */
@@ -115429,12 +115435,16 @@ var require_chainId = __commonJS({
115429
115435
  BUNDLE_ANALYZER: "bundle-analyze",
115430
115436
  /** BottomTemplatePlugin */
115431
115437
  BOTTOM_TEMPLATE: "bottom-template",
115432
- /** HtmlCrossOriginPlugin */
115433
- HTML_CROSS_ORIGIN: "html-cross-origin",
115438
+ /** HtmlTagsPlugin */
115439
+ HTML_TAGS: "html-tags",
115434
115440
  /** HtmlNoncePlugin */
115435
115441
  HTML_NONCE: "html-nonce",
115442
+ /** HtmlCrossOriginPlugin */
115443
+ HTML_CROSS_ORIGIN: "html-cross-origin",
115436
115444
  /** MiniCssExtractPlugin */
115437
115445
  MINI_CSS_EXTRACT: "mini-css-extract",
115446
+ /** VueLoaderPlugin */
115447
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
115438
115448
  /** ReactFastRefreshPlugin */
115439
115449
  REACT_FAST_REFRESH: "react-fast-refresh",
115440
115450
  /** ProvidePlugin for node polyfill */
@@ -115448,9 +115458,7 @@ var require_chainId = __commonJS({
115448
115458
  /** HtmlAsyncChunkPlugin */
115449
115459
  HTML_ASYNC_CHUNK: "html-async-chunk",
115450
115460
  /** SWC_POLYFILL_CHECKER */
115451
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
115452
- /** HtmlTagsPlugin */
115453
- HTML_TAGS: "html-tags"
115461
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
115454
115462
  },
115455
115463
  /** Predefined minimizers */
115456
115464
  MINIMIZER: {
@@ -115492,6 +115500,9 @@ var require_constants = __commonJS({
115492
115500
  ROUTE_SPEC_FILE: function() {
115493
115501
  return ROUTE_SPEC_FILE;
115494
115502
  },
115503
+ NESTED_ROUTE_SPEC_FILE: function() {
115504
+ return NESTED_ROUTE_SPEC_FILE;
115505
+ },
115495
115506
  MAIN_ENTRY_NAME: function() {
115496
115507
  return MAIN_ENTRY_NAME;
115497
115508
  },
@@ -115576,9 +115587,6 @@ var require_constants = __commonJS({
115576
115587
  INTERNAL_SERVER_PLUGINS: function() {
115577
115588
  return INTERNAL_SERVER_PLUGINS;
115578
115589
  },
115579
- PLUGIN_SCHEMAS: function() {
115580
- return PLUGIN_SCHEMAS;
115581
- },
115582
115590
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
115583
115591
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
115584
115592
  }
@@ -115586,6 +115594,7 @@ var require_constants = __commonJS({
115586
115594
  var _export_star = require_export_star();
115587
115595
  _export_star._(require_chainId(), exports);
115588
115596
  var ROUTE_SPEC_FILE = "route.json";
115597
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
115589
115598
  var MAIN_ENTRY_NAME = "main";
115590
115599
  var SERVER_BUNDLE_DIRECTORY = "bundles";
115591
115600
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -115632,8 +115641,6 @@ var require_constants = __commonJS({
115632
115641
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
115633
115642
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
115634
115643
  "@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
115644
  // legacy router (inner react-router-dom v5)
115638
115645
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
115639
115646
  };
@@ -115664,8 +115671,6 @@ var require_constants = __commonJS({
115664
115671
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
115665
115672
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
115666
115673
  "@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
115674
  // legacy router (inner react-router-dom v5)
115670
115675
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
115671
115676
  };
@@ -115681,214 +115686,6 @@ var require_constants = __commonJS({
115681
115686
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
115682
115687
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
115683
115688
  };
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
115689
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
115893
115690
  allowNamespaces: true,
115894
115691
  allExtensions: true,
@@ -116318,6 +116115,7 @@ var require_project = __commonJS({
116318
116115
  });
116319
116116
  var _interop_require_default = require_interop_require_default();
116320
116117
  var _path = /* @__PURE__ */ _interop_require_default._(require("path"));
116118
+ var _pkgup = /* @__PURE__ */ _interop_require_default._(require_pkg_up2());
116321
116119
  var _commands = require_commands();
116322
116120
  var _compiled = require_compiled();
116323
116121
  var _common = require_common3();
@@ -116343,19 +116141,24 @@ var require_project = __commonJS({
116343
116141
  return false;
116344
116142
  }
116345
116143
  };
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);
116144
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
116145
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
116146
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
116349
116147
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
116350
- return !existSrc || Boolean(options["api-only"]);
116148
+ if (options["api-only"]) {
116149
+ return true;
116150
+ }
116151
+ return existApi && !existSrc;
116351
116152
  });
116352
116153
  var isWebOnly = () => __async(exports, null, function* () {
116353
116154
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
116354
116155
  return Boolean(options["web-only"]);
116355
116156
  });
116356
116157
  var isBeyondReact17 = (cwd) => {
116357
- const pkgPath = _path.default.join(cwd, "package.json");
116358
- if (!_compiled.fs.existsSync(pkgPath)) {
116158
+ const pkgPath = _pkgup.default.sync({
116159
+ cwd
116160
+ });
116161
+ if (!pkgPath) {
116359
116162
  return false;
116360
116163
  }
116361
116164
  const pkgInfo = JSON.parse(_compiled.fs.readFileSync(pkgPath, "utf8"));
@@ -116681,21 +116484,6 @@ var require_get2 = __commonJS({
116681
116484
  }
116682
116485
  });
116683
116486
 
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
116487
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
116700
116488
  var require_logger2 = __commonJS({
116701
116489
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -116718,7 +116506,6 @@ var require_logger2 = __commonJS({
116718
116506
  return logger2;
116719
116507
  }
116720
116508
  });
116721
- var _define_property15 = require_define_property();
116722
116509
  var _interop_require_default = require_interop_require_default();
116723
116510
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
116724
116511
  var LOG_LEVEL = {
@@ -116804,10 +116591,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
116804
116591
  return longestLabel;
116805
116592
  }
116806
116593
  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
116594
  this.level = options.level || LOG_TYPES.log.level;
116812
116595
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
116813
116596
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -117737,31 +117520,6 @@ var require_runtimeExports = __commonJS({
117737
117520
  }
117738
117521
  });
117739
117522
 
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
117523
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
117766
117524
  var require_watch = __commonJS({
117767
117525
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -117858,7 +117616,6 @@ var require_cli = __commonJS({
117858
117616
  _export_star._(require_require(), exports);
117859
117617
  _export_star._(require_routes(), exports);
117860
117618
  _export_star._(require_runtimeExports(), exports);
117861
- _export_star._(require_test(), exports);
117862
117619
  _export_star._(require_watch(), exports);
117863
117620
  }
117864
117621
  });
@@ -133268,7 +133025,7 @@ var ZH_LOCALE2 = {
133268
133025
  function: {
133269
133026
  self: "启用可选功能",
133270
133027
  question: "请选择功能名称",
133271
- tailwindcss: "启用 「Tailwind CSS」 支持",
133028
+ tailwindcss: "启用「Tailwind CSS」 支持",
133272
133029
  bff: "启用「BFF」功能",
133273
133030
  micro_frontend: "启用「微前端」模式",
133274
133031
  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.23",
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
+ "@scripts/build": "2.23.1",
34
+ "@scripts/jest-config": "2.23.1",
35
+ "@modern-js/plugin-i18n": "2.23.1",
36
+ "@modern-js/generator-utils": "3.1.23",
37
+ "@modern-js/generator-common": "3.1.23"
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": {