@modern-js/base-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 +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();
@@ -113897,6 +113897,9 @@ var require_constants = __commonJS({
113897
113897
  ROUTE_SPEC_FILE: function() {
113898
113898
  return ROUTE_SPEC_FILE;
113899
113899
  },
113900
+ NESTED_ROUTE_SPEC_FILE: function() {
113901
+ return NESTED_ROUTE_SPEC_FILE;
113902
+ },
113900
113903
  MAIN_ENTRY_NAME: function() {
113901
113904
  return MAIN_ENTRY_NAME;
113902
113905
  },
@@ -113981,9 +113984,6 @@ var require_constants = __commonJS({
113981
113984
  INTERNAL_SERVER_PLUGINS: function() {
113982
113985
  return INTERNAL_SERVER_PLUGINS;
113983
113986
  },
113984
- PLUGIN_SCHEMAS: function() {
113985
- return PLUGIN_SCHEMAS;
113986
- },
113987
113987
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
113988
113988
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
113989
113989
  }
@@ -113991,6 +113991,7 @@ var require_constants = __commonJS({
113991
113991
  var _export_star = require_export_star();
113992
113992
  _export_star._(require_chainId(), exports);
113993
113993
  var ROUTE_SPEC_FILE = "route.json";
113994
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
113994
113995
  var MAIN_ENTRY_NAME = "main";
113995
113996
  var SERVER_BUNDLE_DIRECTORY = "bundles";
113996
113997
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -114037,8 +114038,6 @@ var require_constants = __commonJS({
114037
114038
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
114038
114039
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
114039
114040
  "@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
114041
  // legacy router (inner react-router-dom v5)
114043
114042
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
114044
114043
  };
@@ -114069,8 +114068,6 @@ var require_constants = __commonJS({
114069
114068
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
114070
114069
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
114071
114070
  "@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
114071
  // legacy router (inner react-router-dom v5)
114075
114072
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
114076
114073
  };
@@ -114086,214 +114083,6 @@ var require_constants = __commonJS({
114086
114083
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
114087
114084
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
114088
114085
  };
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
114086
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
114298
114087
  allowNamespaces: true,
114299
114088
  allExtensions: true,
@@ -114748,11 +114537,14 @@ var require_project = __commonJS({
114748
114537
  return false;
114749
114538
  }
114750
114539
  };
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);
114540
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
114541
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
114542
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
114754
114543
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
114755
- return !existSrc || Boolean(options["api-only"]);
114544
+ if (options["api-only"]) {
114545
+ return true;
114546
+ }
114547
+ return existApi && !existSrc;
114756
114548
  });
114757
114549
  var isWebOnly = () => __async(exports, null, function* () {
114758
114550
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
@@ -115086,21 +114878,6 @@ var require_get2 = __commonJS({
115086
114878
  }
115087
114879
  });
115088
114880
 
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
114881
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
115105
114882
  var require_logger2 = __commonJS({
115106
114883
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -115123,7 +114900,6 @@ var require_logger2 = __commonJS({
115123
114900
  return logger;
115124
114901
  }
115125
114902
  });
115126
- var _define_property14 = require_define_property();
115127
114903
  var _interop_require_default = require_interop_require_default();
115128
114904
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
115129
114905
  var LOG_LEVEL = {
@@ -115209,10 +114985,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
115209
114985
  return longestLabel;
115210
114986
  }
115211
114987
  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
114988
  this.level = options.level || LOG_TYPES.log.level;
115217
114989
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
115218
114990
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -116142,31 +115914,6 @@ var require_runtimeExports = __commonJS({
116142
115914
  }
116143
115915
  });
116144
115916
 
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
115917
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
116171
115918
  var require_watch = __commonJS({
116172
115919
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -116263,7 +116010,6 @@ var require_cli = __commonJS({
116263
116010
  _export_star._(require_require(), exports);
116264
116011
  _export_star._(require_routes(), exports);
116265
116012
  _export_star._(require_runtimeExports(), exports);
116266
- _export_star._(require_test(), exports);
116267
116013
  _export_star._(require_watch(), exports);
116268
116014
  }
116269
116015
  });
@@ -131189,7 +130935,7 @@ var ZH_LOCALE2 = {
131189
130935
  function: {
131190
130936
  self: "启用可选功能",
131191
130937
  question: "请选择功能名称",
131192
- tailwindcss: "启用 「Tailwind CSS」 支持",
130938
+ tailwindcss: "启用「Tailwind CSS」 支持",
131193
130939
  bff: "启用「BFF」功能",
131194
130940
  micro_frontend: "启用「微前端」模式",
131195
130941
  i18n: "启用「国际化(i18n)」功能",
@@ -131478,8 +131224,6 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
131478
131224
  }
131479
131225
  generator.logger.debug(`forge @modern-js/base-generator succeed `);
131480
131226
  });
131481
- // Annotate the CommonJS export names for ESM import in node:
131482
- 0 && (module.exports = {});
131483
131227
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
131484
131228
  /*!
131485
131229
  * 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",
@@ -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.22",
34
+ "@modern-js/generator-utils": "3.1.22",
35
+ "@scripts/build": "2.23.0",
36
+ "@scripts/jest-config": "2.23.0"
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",