@modern-js/packages-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 +34 -279
  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();
@@ -115762,10 +115762,14 @@ var require_chainId = __commonJS({
115762
115762
  SVG: "svg",
115763
115763
  /** Rule for pug */
115764
115764
  PUG: "pug",
115765
+ /** Rule for Vue */
115766
+ VUE: "vue",
115765
115767
  /** Rule for toml */
115766
115768
  TOML: "toml",
115767
115769
  /** Rule for yaml */
115768
115770
  YAML: "yaml",
115771
+ /** Rule for wasm */
115772
+ WASM: "wasm",
115769
115773
  /** Rule for bff */
115770
115774
  JS_BFF_API: "js-bff-api"
115771
115775
  },
@@ -115792,6 +115796,8 @@ var require_chainId = __commonJS({
115792
115796
  URL: "url",
115793
115797
  /** pug-loader */
115794
115798
  PUG: "pug",
115799
+ /** vue-loader */
115800
+ VUE: "vue",
115795
115801
  /** file-loader */
115796
115802
  FILE: "file",
115797
115803
  /** @svgr/webpack */
@@ -115861,12 +115867,16 @@ var require_chainId = __commonJS({
115861
115867
  BUNDLE_ANALYZER: "bundle-analyze",
115862
115868
  /** BottomTemplatePlugin */
115863
115869
  BOTTOM_TEMPLATE: "bottom-template",
115864
- /** HtmlCrossOriginPlugin */
115865
- HTML_CROSS_ORIGIN: "html-cross-origin",
115870
+ /** HtmlTagsPlugin */
115871
+ HTML_TAGS: "html-tags",
115866
115872
  /** HtmlNoncePlugin */
115867
115873
  HTML_NONCE: "html-nonce",
115874
+ /** HtmlCrossOriginPlugin */
115875
+ HTML_CROSS_ORIGIN: "html-cross-origin",
115868
115876
  /** MiniCssExtractPlugin */
115869
115877
  MINI_CSS_EXTRACT: "mini-css-extract",
115878
+ /** VueLoaderPlugin */
115879
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
115870
115880
  /** ReactFastRefreshPlugin */
115871
115881
  REACT_FAST_REFRESH: "react-fast-refresh",
115872
115882
  /** ProvidePlugin for node polyfill */
@@ -115880,9 +115890,7 @@ var require_chainId = __commonJS({
115880
115890
  /** HtmlAsyncChunkPlugin */
115881
115891
  HTML_ASYNC_CHUNK: "html-async-chunk",
115882
115892
  /** SWC_POLYFILL_CHECKER */
115883
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
115884
- /** HtmlTagsPlugin */
115885
- HTML_TAGS: "html-tags"
115893
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
115886
115894
  },
115887
115895
  /** Predefined minimizers */
115888
115896
  MINIMIZER: {
@@ -115924,6 +115932,9 @@ var require_constants = __commonJS({
115924
115932
  ROUTE_SPEC_FILE: function() {
115925
115933
  return ROUTE_SPEC_FILE;
115926
115934
  },
115935
+ NESTED_ROUTE_SPEC_FILE: function() {
115936
+ return NESTED_ROUTE_SPEC_FILE;
115937
+ },
115927
115938
  MAIN_ENTRY_NAME: function() {
115928
115939
  return MAIN_ENTRY_NAME;
115929
115940
  },
@@ -116008,9 +116019,6 @@ var require_constants = __commonJS({
116008
116019
  INTERNAL_SERVER_PLUGINS: function() {
116009
116020
  return INTERNAL_SERVER_PLUGINS;
116010
116021
  },
116011
- PLUGIN_SCHEMAS: function() {
116012
- return PLUGIN_SCHEMAS;
116013
- },
116014
116022
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
116015
116023
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
116016
116024
  }
@@ -116018,6 +116026,7 @@ var require_constants = __commonJS({
116018
116026
  var _export_star = require_export_star();
116019
116027
  _export_star._(require_chainId(), exports);
116020
116028
  var ROUTE_SPEC_FILE = "route.json";
116029
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
116021
116030
  var MAIN_ENTRY_NAME = "main";
116022
116031
  var SERVER_BUNDLE_DIRECTORY = "bundles";
116023
116032
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -116064,8 +116073,6 @@ var require_constants = __commonJS({
116064
116073
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
116065
116074
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
116066
116075
  "@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
116076
  // legacy router (inner react-router-dom v5)
116070
116077
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
116071
116078
  };
@@ -116096,8 +116103,6 @@ var require_constants = __commonJS({
116096
116103
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
116097
116104
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
116098
116105
  "@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
116106
  // legacy router (inner react-router-dom v5)
116102
116107
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
116103
116108
  };
@@ -116113,214 +116118,6 @@ var require_constants = __commonJS({
116113
116118
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
116114
116119
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
116115
116120
  };
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
116121
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
116325
116122
  allowNamespaces: true,
116326
116123
  allExtensions: true,
@@ -116750,6 +116547,7 @@ var require_project = __commonJS({
116750
116547
  });
116751
116548
  var _interop_require_default = require_interop_require_default();
116752
116549
  var _path = /* @__PURE__ */ _interop_require_default._(require("path"));
116550
+ var _pkgup = /* @__PURE__ */ _interop_require_default._(require_pkg_up2());
116753
116551
  var _commands = require_commands();
116754
116552
  var _compiled = require_compiled();
116755
116553
  var _common = require_common3();
@@ -116775,19 +116573,24 @@ var require_project = __commonJS({
116775
116573
  return false;
116776
116574
  }
116777
116575
  };
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);
116576
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
116577
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
116578
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
116781
116579
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
116782
- return !existSrc || Boolean(options["api-only"]);
116580
+ if (options["api-only"]) {
116581
+ return true;
116582
+ }
116583
+ return existApi && !existSrc;
116783
116584
  });
116784
116585
  var isWebOnly = () => __async(exports, null, function* () {
116785
116586
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
116786
116587
  return Boolean(options["web-only"]);
116787
116588
  });
116788
116589
  var isBeyondReact17 = (cwd) => {
116789
- const pkgPath = _path.default.join(cwd, "package.json");
116790
- if (!_compiled.fs.existsSync(pkgPath)) {
116590
+ const pkgPath = _pkgup.default.sync({
116591
+ cwd
116592
+ });
116593
+ if (!pkgPath) {
116791
116594
  return false;
116792
116595
  }
116793
116596
  const pkgInfo = JSON.parse(_compiled.fs.readFileSync(pkgPath, "utf8"));
@@ -117113,21 +116916,6 @@ var require_get2 = __commonJS({
117113
116916
  }
117114
116917
  });
117115
116918
 
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
116919
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
117132
116920
  var require_logger2 = __commonJS({
117133
116921
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -117150,7 +116938,6 @@ var require_logger2 = __commonJS({
117150
116938
  return logger;
117151
116939
  }
117152
116940
  });
117153
- var _define_property14 = require_define_property();
117154
116941
  var _interop_require_default = require_interop_require_default();
117155
116942
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
117156
116943
  var LOG_LEVEL = {
@@ -117236,10 +117023,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
117236
117023
  return longestLabel;
117237
117024
  }
117238
117025
  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
117026
  this.level = options.level || LOG_TYPES.log.level;
117244
117027
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
117245
117028
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -118169,31 +117952,6 @@ var require_runtimeExports = __commonJS({
118169
117952
  }
118170
117953
  });
118171
117954
 
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
117955
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
118198
117956
  var require_watch = __commonJS({
118199
117957
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -118290,7 +118048,6 @@ var require_cli = __commonJS({
118290
118048
  _export_star._(require_require(), exports);
118291
118049
  _export_star._(require_routes(), exports);
118292
118050
  _export_star._(require_runtimeExports(), exports);
118293
- _export_star._(require_test(), exports);
118294
118051
  _export_star._(require_watch(), exports);
118295
118052
  }
118296
118053
  });
@@ -133681,8 +133438,6 @@ var src_default = (context, generator) => __async(void 0, null, function* () {
133681
133438
  yield handleTemplateFile(context, generator);
133682
133439
  generator.logger.debug(`forge @modern-js/packages-generator succeed `);
133683
133440
  });
133684
- // Annotate the CommonJS export names for ESM import in node:
133685
- 0 && (module.exports = {});
133686
133441
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
133687
133442
  /*!
133688
133443
  * 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
  "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.1",
34
+ "@scripts/jest-config": "2.23.1",
35
+ "@modern-js/generator-utils": "3.1.23",
36
+ "@modern-js/generator-common": "3.1.23"
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": {