@modern-js/packages-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 +16 -272
  2. package/package.json +7 -6
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();
@@ -115924,6 +115924,9 @@ var require_constants = __commonJS({
115924
115924
  ROUTE_SPEC_FILE: function() {
115925
115925
  return ROUTE_SPEC_FILE;
115926
115926
  },
115927
+ NESTED_ROUTE_SPEC_FILE: function() {
115928
+ return NESTED_ROUTE_SPEC_FILE;
115929
+ },
115927
115930
  MAIN_ENTRY_NAME: function() {
115928
115931
  return MAIN_ENTRY_NAME;
115929
115932
  },
@@ -116008,9 +116011,6 @@ var require_constants = __commonJS({
116008
116011
  INTERNAL_SERVER_PLUGINS: function() {
116009
116012
  return INTERNAL_SERVER_PLUGINS;
116010
116013
  },
116011
- PLUGIN_SCHEMAS: function() {
116012
- return PLUGIN_SCHEMAS;
116013
- },
116014
116014
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
116015
116015
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
116016
116016
  }
@@ -116018,6 +116018,7 @@ var require_constants = __commonJS({
116018
116018
  var _export_star = require_export_star();
116019
116019
  _export_star._(require_chainId(), exports);
116020
116020
  var ROUTE_SPEC_FILE = "route.json";
116021
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
116021
116022
  var MAIN_ENTRY_NAME = "main";
116022
116023
  var SERVER_BUNDLE_DIRECTORY = "bundles";
116023
116024
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -116064,8 +116065,6 @@ var require_constants = __commonJS({
116064
116065
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
116065
116066
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
116066
116067
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
116067
- // TODO: Maybe can remove it
116068
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
116069
116068
  // legacy router (inner react-router-dom v5)
116070
116069
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
116071
116070
  };
@@ -116096,8 +116095,6 @@ var require_constants = __commonJS({
116096
116095
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
116097
116096
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
116098
116097
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
116099
- // TODO: Maybe can remove it
116100
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
116101
116098
  // legacy router (inner react-router-dom v5)
116102
116099
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
116103
116100
  };
@@ -116113,214 +116110,6 @@ var require_constants = __commonJS({
116113
116110
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
116114
116111
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
116115
116112
  };
116116
- var PLUGIN_SCHEMAS = {
116117
- "@modern-js/runtime": [
116118
- {
116119
- target: "runtime",
116120
- schema: {
116121
- type: "object",
116122
- additionalProperties: false
116123
- }
116124
- },
116125
- {
116126
- target: "runtimeByEntries",
116127
- schema: {
116128
- type: "object",
116129
- patternProperties: {
116130
- [ENTRY_NAME_PATTERN]: {
116131
- type: "object"
116132
- }
116133
- },
116134
- additionalProperties: false
116135
- }
116136
- }
116137
- ],
116138
- "@modern-js/plugin-swc": [
116139
- {
116140
- target: "tools.swc",
116141
- schema: {
116142
- typeof: [
116143
- "object"
116144
- ]
116145
- }
116146
- }
116147
- ],
116148
- "@modern-js/plugin-bff": [
116149
- {
116150
- target: "bff",
116151
- schema: {
116152
- type: "object",
116153
- properties: {
116154
- prefix: {
116155
- type: [
116156
- "string",
116157
- "array"
116158
- ],
116159
- items: {
116160
- type: "string"
116161
- }
116162
- },
116163
- fetcher: {
116164
- type: "string"
116165
- },
116166
- proxy: {
116167
- type: "object"
116168
- },
116169
- requestCreator: {
116170
- type: "string"
116171
- }
116172
- }
116173
- }
116174
- }
116175
- ],
116176
- "@modern-js/plugin-tailwindcss": [
116177
- {
116178
- target: "tools.tailwindcss",
116179
- schema: {
116180
- typeof: [
116181
- "object",
116182
- "function"
116183
- ]
116184
- }
116185
- }
116186
- ],
116187
- "@modern-js/plugin-proxy": [
116188
- {
116189
- target: "dev.proxy",
116190
- schema: {
116191
- typeof: [
116192
- "string",
116193
- "object"
116194
- ]
116195
- }
116196
- }
116197
- ],
116198
- "@modern-js/plugin-ssg": [
116199
- {
116200
- target: "output.ssg",
116201
- schema: {
116202
- oneOf: [
116203
- {
116204
- type: "boolean"
116205
- },
116206
- {
116207
- type: "object"
116208
- },
116209
- {
116210
- instanceof: "Function"
116211
- }
116212
- ]
116213
- }
116214
- }
116215
- ],
116216
- "@modern-js/plugin-state": [
116217
- {
116218
- target: "runtime.state",
116219
- schema: {
116220
- type: [
116221
- "boolean",
116222
- "object"
116223
- ]
116224
- }
116225
- }
116226
- ],
116227
- "@modern-js/plugin-design-token": [
116228
- // Legacy Features
116229
- {
116230
- target: "source.designSystem",
116231
- schema: {
116232
- typeof: [
116233
- "object"
116234
- ]
116235
- }
116236
- },
116237
- {
116238
- target: "source.designSystem.supportStyledComponents",
116239
- schema: {
116240
- type: [
116241
- "boolean"
116242
- ]
116243
- }
116244
- },
116245
- {
116246
- target: "designSystem",
116247
- schema: {
116248
- typeof: [
116249
- "object"
116250
- ]
116251
- }
116252
- }
116253
- ],
116254
- "@modern-js/plugin-router": [
116255
- {
116256
- target: "runtime.router",
116257
- schema: {
116258
- type: [
116259
- "boolean",
116260
- "object"
116261
- ]
116262
- }
116263
- }
116264
- ],
116265
- "@modern-js/plugin-testing": [
116266
- {
116267
- target: "testing",
116268
- schema: {
116269
- typeof: [
116270
- "object"
116271
- ]
116272
- }
116273
- },
116274
- {
116275
- target: "tools.jest",
116276
- schema: {
116277
- typeof: [
116278
- "object",
116279
- "function"
116280
- ]
116281
- }
116282
- }
116283
- ],
116284
- "@modern-js/plugin-garfish": [
116285
- {
116286
- target: "runtime.masterApp",
116287
- schema: {
116288
- type: [
116289
- "boolean",
116290
- "object"
116291
- ]
116292
- }
116293
- },
116294
- {
116295
- target: "dev.withMasterApp",
116296
- schema: {
116297
- type: [
116298
- "object"
116299
- ]
116300
- }
116301
- },
116302
- {
116303
- target: "deploy.microFrontend",
116304
- schema: {
116305
- type: [
116306
- "boolean",
116307
- "object"
116308
- ]
116309
- }
116310
- }
116311
- ],
116312
- "@modern-js/plugin-nocode": [],
116313
- "@modern-js/plugin-worker": [
116314
- {
116315
- target: "deploy.worker.ssr",
116316
- schema: {
116317
- type: [
116318
- "boolean"
116319
- ]
116320
- }
116321
- }
116322
- ]
116323
- };
116324
116113
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
116325
116114
  allowNamespaces: true,
116326
116115
  allExtensions: true,
@@ -116775,11 +116564,14 @@ var require_project = __commonJS({
116775
116564
  return false;
116776
116565
  }
116777
116566
  };
116778
- var isApiOnly = (appDirectory, entryDir) => __async(exports, null, function* () {
116779
- const srcDir = _path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
116780
- const existSrc = yield _compiled.fs.pathExists(srcDir);
116567
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
116568
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
116569
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
116781
116570
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
116782
- return !existSrc || Boolean(options["api-only"]);
116571
+ if (options["api-only"]) {
116572
+ return true;
116573
+ }
116574
+ return existApi && !existSrc;
116783
116575
  });
116784
116576
  var isWebOnly = () => __async(exports, null, function* () {
116785
116577
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
@@ -117113,21 +116905,6 @@ var require_get2 = __commonJS({
117113
116905
  }
117114
116906
  });
117115
116907
 
117116
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs
117117
- var require_define_property = __commonJS({
117118
- "../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs"(exports) {
117119
- "use strict";
117120
- exports._ = exports._define_property = _define_property14;
117121
- function _define_property14(obj, key, value) {
117122
- if (key in obj) {
117123
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
117124
- } else
117125
- obj[key] = value;
117126
- return obj;
117127
- }
117128
- }
117129
- });
117130
-
117131
116908
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
117132
116909
  var require_logger2 = __commonJS({
117133
116910
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -117150,7 +116927,6 @@ var require_logger2 = __commonJS({
117150
116927
  return logger;
117151
116928
  }
117152
116929
  });
117153
- var _define_property14 = require_define_property();
117154
116930
  var _interop_require_default = require_interop_require_default();
117155
116931
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
117156
116932
  var LOG_LEVEL = {
@@ -117236,10 +117012,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
117236
117012
  return longestLabel;
117237
117013
  }
117238
117014
  constructor(options = {}) {
117239
- _define_property14._(this, "level", void 0);
117240
- _define_property14._(this, "config", void 0);
117241
- _define_property14._(this, "types", void 0);
117242
- _define_property14._(this, "longestLabel", void 0);
117243
117015
  this.level = options.level || LOG_TYPES.log.level;
117244
117016
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
117245
117017
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -118169,31 +117941,6 @@ var require_runtimeExports = __commonJS({
118169
117941
  }
118170
117942
  });
118171
117943
 
118172
- // ../../../toolkit/utils/dist/cjs/cli/test.js
118173
- var require_test = __commonJS({
118174
- "../../../toolkit/utils/dist/cjs/cli/test.js"(exports) {
118175
- "use strict";
118176
- Object.defineProperty(exports, "__esModule", {
118177
- value: true
118178
- });
118179
- Object.defineProperty(exports, "initSnapshotSerializer", {
118180
- enumerable: true,
118181
- get: function() {
118182
- return initSnapshotSerializer;
118183
- }
118184
- });
118185
- var initSnapshotSerializer = (root) => {
118186
- expect.addSnapshotSerializer({
118187
- test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
118188
- print: (val) => (
118189
- // eslint-disable-next-line no-nested-ternary
118190
- 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
118191
- )
118192
- });
118193
- };
118194
- }
118195
- });
118196
-
118197
117944
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
118198
117945
  var require_watch = __commonJS({
118199
117946
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -118290,7 +118037,6 @@ var require_cli = __commonJS({
118290
118037
  _export_star._(require_require(), exports);
118291
118038
  _export_star._(require_routes(), exports);
118292
118039
  _export_star._(require_runtimeExports(), exports);
118293
- _export_star._(require_test(), exports);
118294
118040
  _export_star._(require_watch(), exports);
118295
118041
  }
118296
118042
  });
@@ -133681,8 +133427,6 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
133681
133427
  yield handleTemplateFile(context, generator);
133682
133428
  generator.logger.debug(`forge @modern-js/packages-generator succeed `);
133683
133429
  });
133684
- // Annotate the CommonJS export names for ESM import in node:
133685
- 0 && (module.exports = {});
133686
133430
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
133687
133431
  /*!
133688
133432
  * 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
  "main": "./dist/index.js",
21
21
  "files": [
@@ -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
- "@scripts/build": "2.22.1",
35
- "@modern-js/generator-utils": "3.1.21",
36
- "@modern-js/generator-common": "3.1.21"
33
+ "@scripts/build": "2.23.0",
34
+ "@scripts/jest-config": "2.23.0",
35
+ "@modern-js/generator-common": "3.1.22",
36
+ "@modern-js/generator-utils": "3.1.22"
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
  "types": "./src/index.ts",
44
45
  "scripts": {