@modern-js/base-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 +7 -6
package/dist/index.js CHANGED
@@ -42252,7 +42252,7 @@ var require_parse = __commonJS({
42252
42252
  return current.type === "Punctuator" ? current.value : current.type;
42253
42253
  };
42254
42254
  var is = (t) => type() === t;
42255
- var expect2 = (a) => {
42255
+ var expect = (a) => {
42256
42256
  if (!is(a)) {
42257
42257
  unexpected();
42258
42258
  }
@@ -42334,7 +42334,7 @@ var require_parse = __commonJS({
42334
42334
  while (!is(CURLY_BRACKET_CLOSE)) {
42335
42335
  if (started) {
42336
42336
  assign_comments(PREFIX_AFTER_VALUE);
42337
- expect2(COMMA);
42337
+ expect(COMMA);
42338
42338
  next();
42339
42339
  parse_comments();
42340
42340
  assign_after_comments();
@@ -42343,13 +42343,13 @@ var require_parse = __commonJS({
42343
42343
  }
42344
42344
  }
42345
42345
  started = true;
42346
- expect2("String");
42346
+ expect("String");
42347
42347
  name = JSON.parse(current.value);
42348
42348
  set_prop(name);
42349
42349
  assign_comments(PREFIX_BEFORE);
42350
42350
  next();
42351
42351
  parse_comments(PREFIX_AFTER_PROP);
42352
- expect2(COLON);
42352
+ expect(COLON);
42353
42353
  next();
42354
42354
  parse_comments(PREFIX_AFTER_COLON);
42355
42355
  obj[name] = transform(name, walk());
@@ -42377,7 +42377,7 @@ var require_parse = __commonJS({
42377
42377
  while (!is(BRACKET_CLOSE)) {
42378
42378
  if (started) {
42379
42379
  assign_comments(PREFIX_AFTER_VALUE);
42380
- expect2(COMMA);
42380
+ expect(COMMA);
42381
42381
  next();
42382
42382
  parse_comments();
42383
42383
  assign_after_comments();
@@ -113735,10 +113735,14 @@ var require_chainId = __commonJS({
113735
113735
  SVG: "svg",
113736
113736
  /** Rule for pug */
113737
113737
  PUG: "pug",
113738
+ /** Rule for Vue */
113739
+ VUE: "vue",
113738
113740
  /** Rule for toml */
113739
113741
  TOML: "toml",
113740
113742
  /** Rule for yaml */
113741
113743
  YAML: "yaml",
113744
+ /** Rule for wasm */
113745
+ WASM: "wasm",
113742
113746
  /** Rule for bff */
113743
113747
  JS_BFF_API: "js-bff-api"
113744
113748
  },
@@ -113765,6 +113769,8 @@ var require_chainId = __commonJS({
113765
113769
  URL: "url",
113766
113770
  /** pug-loader */
113767
113771
  PUG: "pug",
113772
+ /** vue-loader */
113773
+ VUE: "vue",
113768
113774
  /** file-loader */
113769
113775
  FILE: "file",
113770
113776
  /** @svgr/webpack */
@@ -113834,12 +113840,16 @@ var require_chainId = __commonJS({
113834
113840
  BUNDLE_ANALYZER: "bundle-analyze",
113835
113841
  /** BottomTemplatePlugin */
113836
113842
  BOTTOM_TEMPLATE: "bottom-template",
113837
- /** HtmlCrossOriginPlugin */
113838
- HTML_CROSS_ORIGIN: "html-cross-origin",
113843
+ /** HtmlTagsPlugin */
113844
+ HTML_TAGS: "html-tags",
113839
113845
  /** HtmlNoncePlugin */
113840
113846
  HTML_NONCE: "html-nonce",
113847
+ /** HtmlCrossOriginPlugin */
113848
+ HTML_CROSS_ORIGIN: "html-cross-origin",
113841
113849
  /** MiniCssExtractPlugin */
113842
113850
  MINI_CSS_EXTRACT: "mini-css-extract",
113851
+ /** VueLoaderPlugin */
113852
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
113843
113853
  /** ReactFastRefreshPlugin */
113844
113854
  REACT_FAST_REFRESH: "react-fast-refresh",
113845
113855
  /** ProvidePlugin for node polyfill */
@@ -113853,9 +113863,7 @@ var require_chainId = __commonJS({
113853
113863
  /** HtmlAsyncChunkPlugin */
113854
113864
  HTML_ASYNC_CHUNK: "html-async-chunk",
113855
113865
  /** SWC_POLYFILL_CHECKER */
113856
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
113857
- /** HtmlTagsPlugin */
113858
- HTML_TAGS: "html-tags"
113866
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
113859
113867
  },
113860
113868
  /** Predefined minimizers */
113861
113869
  MINIMIZER: {
@@ -113897,6 +113905,9 @@ var require_constants = __commonJS({
113897
113905
  ROUTE_SPEC_FILE: function() {
113898
113906
  return ROUTE_SPEC_FILE;
113899
113907
  },
113908
+ NESTED_ROUTE_SPEC_FILE: function() {
113909
+ return NESTED_ROUTE_SPEC_FILE;
113910
+ },
113900
113911
  MAIN_ENTRY_NAME: function() {
113901
113912
  return MAIN_ENTRY_NAME;
113902
113913
  },
@@ -113981,9 +113992,6 @@ var require_constants = __commonJS({
113981
113992
  INTERNAL_SERVER_PLUGINS: function() {
113982
113993
  return INTERNAL_SERVER_PLUGINS;
113983
113994
  },
113984
- PLUGIN_SCHEMAS: function() {
113985
- return PLUGIN_SCHEMAS;
113986
- },
113987
113995
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
113988
113996
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
113989
113997
  }
@@ -113991,6 +113999,7 @@ var require_constants = __commonJS({
113991
113999
  var _export_star = require_export_star();
113992
114000
  _export_star._(require_chainId(), exports);
113993
114001
  var ROUTE_SPEC_FILE = "route.json";
114002
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
113994
114003
  var MAIN_ENTRY_NAME = "main";
113995
114004
  var SERVER_BUNDLE_DIRECTORY = "bundles";
113996
114005
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -114037,8 +114046,6 @@ var require_constants = __commonJS({
114037
114046
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
114038
114047
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
114039
114048
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
114040
- // TODO: Maybe can remove it
114041
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
114042
114049
  // legacy router (inner react-router-dom v5)
114043
114050
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
114044
114051
  };
@@ -114069,8 +114076,6 @@ var require_constants = __commonJS({
114069
114076
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
114070
114077
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
114071
114078
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
114072
- // TODO: Maybe can remove it
114073
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
114074
114079
  // legacy router (inner react-router-dom v5)
114075
114080
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
114076
114081
  };
@@ -114086,214 +114091,6 @@ var require_constants = __commonJS({
114086
114091
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
114087
114092
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
114088
114093
  };
114089
- var PLUGIN_SCHEMAS = {
114090
- "@modern-js/runtime": [
114091
- {
114092
- target: "runtime",
114093
- schema: {
114094
- type: "object",
114095
- additionalProperties: false
114096
- }
114097
- },
114098
- {
114099
- target: "runtimeByEntries",
114100
- schema: {
114101
- type: "object",
114102
- patternProperties: {
114103
- [ENTRY_NAME_PATTERN]: {
114104
- type: "object"
114105
- }
114106
- },
114107
- additionalProperties: false
114108
- }
114109
- }
114110
- ],
114111
- "@modern-js/plugin-swc": [
114112
- {
114113
- target: "tools.swc",
114114
- schema: {
114115
- typeof: [
114116
- "object"
114117
- ]
114118
- }
114119
- }
114120
- ],
114121
- "@modern-js/plugin-bff": [
114122
- {
114123
- target: "bff",
114124
- schema: {
114125
- type: "object",
114126
- properties: {
114127
- prefix: {
114128
- type: [
114129
- "string",
114130
- "array"
114131
- ],
114132
- items: {
114133
- type: "string"
114134
- }
114135
- },
114136
- fetcher: {
114137
- type: "string"
114138
- },
114139
- proxy: {
114140
- type: "object"
114141
- },
114142
- requestCreator: {
114143
- type: "string"
114144
- }
114145
- }
114146
- }
114147
- }
114148
- ],
114149
- "@modern-js/plugin-tailwindcss": [
114150
- {
114151
- target: "tools.tailwindcss",
114152
- schema: {
114153
- typeof: [
114154
- "object",
114155
- "function"
114156
- ]
114157
- }
114158
- }
114159
- ],
114160
- "@modern-js/plugin-proxy": [
114161
- {
114162
- target: "dev.proxy",
114163
- schema: {
114164
- typeof: [
114165
- "string",
114166
- "object"
114167
- ]
114168
- }
114169
- }
114170
- ],
114171
- "@modern-js/plugin-ssg": [
114172
- {
114173
- target: "output.ssg",
114174
- schema: {
114175
- oneOf: [
114176
- {
114177
- type: "boolean"
114178
- },
114179
- {
114180
- type: "object"
114181
- },
114182
- {
114183
- instanceof: "Function"
114184
- }
114185
- ]
114186
- }
114187
- }
114188
- ],
114189
- "@modern-js/plugin-state": [
114190
- {
114191
- target: "runtime.state",
114192
- schema: {
114193
- type: [
114194
- "boolean",
114195
- "object"
114196
- ]
114197
- }
114198
- }
114199
- ],
114200
- "@modern-js/plugin-design-token": [
114201
- // Legacy Features
114202
- {
114203
- target: "source.designSystem",
114204
- schema: {
114205
- typeof: [
114206
- "object"
114207
- ]
114208
- }
114209
- },
114210
- {
114211
- target: "source.designSystem.supportStyledComponents",
114212
- schema: {
114213
- type: [
114214
- "boolean"
114215
- ]
114216
- }
114217
- },
114218
- {
114219
- target: "designSystem",
114220
- schema: {
114221
- typeof: [
114222
- "object"
114223
- ]
114224
- }
114225
- }
114226
- ],
114227
- "@modern-js/plugin-router": [
114228
- {
114229
- target: "runtime.router",
114230
- schema: {
114231
- type: [
114232
- "boolean",
114233
- "object"
114234
- ]
114235
- }
114236
- }
114237
- ],
114238
- "@modern-js/plugin-testing": [
114239
- {
114240
- target: "testing",
114241
- schema: {
114242
- typeof: [
114243
- "object"
114244
- ]
114245
- }
114246
- },
114247
- {
114248
- target: "tools.jest",
114249
- schema: {
114250
- typeof: [
114251
- "object",
114252
- "function"
114253
- ]
114254
- }
114255
- }
114256
- ],
114257
- "@modern-js/plugin-garfish": [
114258
- {
114259
- target: "runtime.masterApp",
114260
- schema: {
114261
- type: [
114262
- "boolean",
114263
- "object"
114264
- ]
114265
- }
114266
- },
114267
- {
114268
- target: "dev.withMasterApp",
114269
- schema: {
114270
- type: [
114271
- "object"
114272
- ]
114273
- }
114274
- },
114275
- {
114276
- target: "deploy.microFrontend",
114277
- schema: {
114278
- type: [
114279
- "boolean",
114280
- "object"
114281
- ]
114282
- }
114283
- }
114284
- ],
114285
- "@modern-js/plugin-nocode": [],
114286
- "@modern-js/plugin-worker": [
114287
- {
114288
- target: "deploy.worker.ssr",
114289
- schema: {
114290
- type: [
114291
- "boolean"
114292
- ]
114293
- }
114294
- }
114295
- ]
114296
- };
114297
114094
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
114298
114095
  allowNamespaces: true,
114299
114096
  allExtensions: true,
@@ -114723,6 +114520,7 @@ var require_project = __commonJS({
114723
114520
  });
114724
114521
  var _interop_require_default = require_interop_require_default();
114725
114522
  var _path = /* @__PURE__ */ _interop_require_default._(require("path"));
114523
+ var _pkgup = /* @__PURE__ */ _interop_require_default._(require_pkg_up2());
114726
114524
  var _commands = require_commands();
114727
114525
  var _compiled = require_compiled();
114728
114526
  var _common = require_common2();
@@ -114748,19 +114546,24 @@ var require_project = __commonJS({
114748
114546
  return false;
114749
114547
  }
114750
114548
  };
114751
- var isApiOnly = (appDirectory, entryDir) => __async(exports, null, function* () {
114752
- const srcDir = _path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
114753
- const existSrc = yield _compiled.fs.pathExists(srcDir);
114549
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
114550
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
114551
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
114754
114552
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
114755
- return !existSrc || Boolean(options["api-only"]);
114553
+ if (options["api-only"]) {
114554
+ return true;
114555
+ }
114556
+ return existApi && !existSrc;
114756
114557
  });
114757
114558
  var isWebOnly = () => __async(exports, null, function* () {
114758
114559
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
114759
114560
  return Boolean(options["web-only"]);
114760
114561
  });
114761
114562
  var isBeyondReact17 = (cwd) => {
114762
- const pkgPath = _path.default.join(cwd, "package.json");
114763
- if (!_compiled.fs.existsSync(pkgPath)) {
114563
+ const pkgPath = _pkgup.default.sync({
114564
+ cwd
114565
+ });
114566
+ if (!pkgPath) {
114764
114567
  return false;
114765
114568
  }
114766
114569
  const pkgInfo = JSON.parse(_compiled.fs.readFileSync(pkgPath, "utf8"));
@@ -115086,21 +114889,6 @@ var require_get2 = __commonJS({
115086
114889
  }
115087
114890
  });
115088
114891
 
115089
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs
115090
- var require_define_property = __commonJS({
115091
- "../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs"(exports) {
115092
- "use strict";
115093
- exports._ = exports._define_property = _define_property14;
115094
- function _define_property14(obj, key, value) {
115095
- if (key in obj) {
115096
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
115097
- } else
115098
- obj[key] = value;
115099
- return obj;
115100
- }
115101
- }
115102
- });
115103
-
115104
114892
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
115105
114893
  var require_logger2 = __commonJS({
115106
114894
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -115123,7 +114911,6 @@ var require_logger2 = __commonJS({
115123
114911
  return logger;
115124
114912
  }
115125
114913
  });
115126
- var _define_property14 = require_define_property();
115127
114914
  var _interop_require_default = require_interop_require_default();
115128
114915
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
115129
114916
  var LOG_LEVEL = {
@@ -115209,10 +114996,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
115209
114996
  return longestLabel;
115210
114997
  }
115211
114998
  constructor(options = {}) {
115212
- _define_property14._(this, "level", void 0);
115213
- _define_property14._(this, "config", void 0);
115214
- _define_property14._(this, "types", void 0);
115215
- _define_property14._(this, "longestLabel", void 0);
115216
114999
  this.level = options.level || LOG_TYPES.log.level;
115217
115000
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
115218
115001
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -116142,31 +115925,6 @@ var require_runtimeExports = __commonJS({
116142
115925
  }
116143
115926
  });
116144
115927
 
116145
- // ../../../toolkit/utils/dist/cjs/cli/test.js
116146
- var require_test = __commonJS({
116147
- "../../../toolkit/utils/dist/cjs/cli/test.js"(exports) {
116148
- "use strict";
116149
- Object.defineProperty(exports, "__esModule", {
116150
- value: true
116151
- });
116152
- Object.defineProperty(exports, "initSnapshotSerializer", {
116153
- enumerable: true,
116154
- get: function() {
116155
- return initSnapshotSerializer;
116156
- }
116157
- });
116158
- var initSnapshotSerializer = (root) => {
116159
- expect.addSnapshotSerializer({
116160
- test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
116161
- print: (val) => (
116162
- // eslint-disable-next-line no-nested-ternary
116163
- 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
116164
- )
116165
- });
116166
- };
116167
- }
116168
- });
116169
-
116170
115928
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
116171
115929
  var require_watch = __commonJS({
116172
115930
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -116263,7 +116021,6 @@ var require_cli = __commonJS({
116263
116021
  _export_star._(require_require(), exports);
116264
116022
  _export_star._(require_routes(), exports);
116265
116023
  _export_star._(require_runtimeExports(), exports);
116266
- _export_star._(require_test(), exports);
116267
116024
  _export_star._(require_watch(), exports);
116268
116025
  }
116269
116026
  });
@@ -131189,7 +130946,7 @@ var ZH_LOCALE2 = {
131189
130946
  function: {
131190
130947
  self: "启用可选功能",
131191
130948
  question: "请选择功能名称",
131192
- tailwindcss: "启用 「Tailwind CSS」 支持",
130949
+ tailwindcss: "启用「Tailwind CSS」 支持",
131193
130950
  bff: "启用「BFF」功能",
131194
130951
  micro_frontend: "启用「微前端」模式",
131195
130952
  i18n: "启用「国际化(i18n)」功能",
@@ -131478,8 +131235,6 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
131478
131235
  }
131479
131236
  generator.logger.debug(`forge @modern-js/base-generator succeed `);
131480
131237
  });
131481
- // Annotate the CommonJS export names for ESM import in node:
131482
- 0 && (module.exports = {});
131483
131238
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
131484
131239
  /*!
131485
131240
  * 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",
@@ -30,15 +30,16 @@
30
30
  "@types/node": "^14",
31
31
  "jest": "^29",
32
32
  "typescript": "^5",
33
- "@scripts/jest-config": "2.22.1",
34
- "@modern-js/generator-utils": "3.1.21",
35
- "@scripts/build": "2.22.1",
36
- "@modern-js/generator-common": "3.1.21"
33
+ "@modern-js/generator-common": "3.1.23",
34
+ "@modern-js/generator-utils": "3.1.23",
35
+ "@scripts/build": "2.23.1",
36
+ "@scripts/jest-config": "2.23.1"
37
37
  },
38
38
  "sideEffects": false,
39
39
  "publishConfig": {
40
40
  "registry": "https://registry.npmjs.org/",
41
- "access": "public"
41
+ "access": "public",
42
+ "provenance": true
42
43
  },
43
44
  "scripts": {
44
45
  "new": "modern-lib new",