@modern-js/ssg-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 +9 -8
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();
@@ -113716,10 +113716,14 @@ var require_chainId = __commonJS({
113716
113716
  SVG: "svg",
113717
113717
  /** Rule for pug */
113718
113718
  PUG: "pug",
113719
+ /** Rule for Vue */
113720
+ VUE: "vue",
113719
113721
  /** Rule for toml */
113720
113722
  TOML: "toml",
113721
113723
  /** Rule for yaml */
113722
113724
  YAML: "yaml",
113725
+ /** Rule for wasm */
113726
+ WASM: "wasm",
113723
113727
  /** Rule for bff */
113724
113728
  JS_BFF_API: "js-bff-api"
113725
113729
  },
@@ -113746,6 +113750,8 @@ var require_chainId = __commonJS({
113746
113750
  URL: "url",
113747
113751
  /** pug-loader */
113748
113752
  PUG: "pug",
113753
+ /** vue-loader */
113754
+ VUE: "vue",
113749
113755
  /** file-loader */
113750
113756
  FILE: "file",
113751
113757
  /** @svgr/webpack */
@@ -113815,12 +113821,16 @@ var require_chainId = __commonJS({
113815
113821
  BUNDLE_ANALYZER: "bundle-analyze",
113816
113822
  /** BottomTemplatePlugin */
113817
113823
  BOTTOM_TEMPLATE: "bottom-template",
113818
- /** HtmlCrossOriginPlugin */
113819
- HTML_CROSS_ORIGIN: "html-cross-origin",
113824
+ /** HtmlTagsPlugin */
113825
+ HTML_TAGS: "html-tags",
113820
113826
  /** HtmlNoncePlugin */
113821
113827
  HTML_NONCE: "html-nonce",
113828
+ /** HtmlCrossOriginPlugin */
113829
+ HTML_CROSS_ORIGIN: "html-cross-origin",
113822
113830
  /** MiniCssExtractPlugin */
113823
113831
  MINI_CSS_EXTRACT: "mini-css-extract",
113832
+ /** VueLoaderPlugin */
113833
+ VUE_LOADER_PLUGIN: "vue-loader-plugin",
113824
113834
  /** ReactFastRefreshPlugin */
113825
113835
  REACT_FAST_REFRESH: "react-fast-refresh",
113826
113836
  /** ProvidePlugin for node polyfill */
@@ -113834,9 +113844,7 @@ var require_chainId = __commonJS({
113834
113844
  /** HtmlAsyncChunkPlugin */
113835
113845
  HTML_ASYNC_CHUNK: "html-async-chunk",
113836
113846
  /** SWC_POLYFILL_CHECKER */
113837
- SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin",
113838
- /** HtmlTagsPlugin */
113839
- HTML_TAGS: "html-tags"
113847
+ SWC_POLYFILL_CHECKER: "swc-polyfill-checker-plugin"
113840
113848
  },
113841
113849
  /** Predefined minimizers */
113842
113850
  MINIMIZER: {
@@ -113878,6 +113886,9 @@ var require_constants = __commonJS({
113878
113886
  ROUTE_SPEC_FILE: function() {
113879
113887
  return ROUTE_SPEC_FILE;
113880
113888
  },
113889
+ NESTED_ROUTE_SPEC_FILE: function() {
113890
+ return NESTED_ROUTE_SPEC_FILE;
113891
+ },
113881
113892
  MAIN_ENTRY_NAME: function() {
113882
113893
  return MAIN_ENTRY_NAME;
113883
113894
  },
@@ -113962,9 +113973,6 @@ var require_constants = __commonJS({
113962
113973
  INTERNAL_SERVER_PLUGINS: function() {
113963
113974
  return INTERNAL_SERVER_PLUGINS;
113964
113975
  },
113965
- PLUGIN_SCHEMAS: function() {
113966
- return PLUGIN_SCHEMAS;
113967
- },
113968
113976
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
113969
113977
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
113970
113978
  }
@@ -113972,6 +113980,7 @@ var require_constants = __commonJS({
113972
113980
  var _export_star = require_export_star();
113973
113981
  _export_star._(require_chainId(), exports);
113974
113982
  var ROUTE_SPEC_FILE = "route.json";
113983
+ var NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
113975
113984
  var MAIN_ENTRY_NAME = "main";
113976
113985
  var SERVER_BUNDLE_DIRECTORY = "bundles";
113977
113986
  var SERVER_WORKER_BUNDLE_DIRECTORY = "worker";
@@ -114018,8 +114027,6 @@ var require_constants = __commonJS({
114018
114027
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
114019
114028
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
114020
114029
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
114021
- // TODO: Maybe can remove it
114022
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
114023
114030
  // legacy router (inner react-router-dom v5)
114024
114031
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
114025
114032
  };
@@ -114050,8 +114057,6 @@ var require_constants = __commonJS({
114050
114057
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
114051
114058
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
114052
114059
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
114053
- // TODO: Maybe can remove it
114054
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
114055
114060
  // legacy router (inner react-router-dom v5)
114056
114061
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
114057
114062
  };
@@ -114067,214 +114072,6 @@ var require_constants = __commonJS({
114067
114072
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
114068
114073
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
114069
114074
  };
114070
- var PLUGIN_SCHEMAS = {
114071
- "@modern-js/runtime": [
114072
- {
114073
- target: "runtime",
114074
- schema: {
114075
- type: "object",
114076
- additionalProperties: false
114077
- }
114078
- },
114079
- {
114080
- target: "runtimeByEntries",
114081
- schema: {
114082
- type: "object",
114083
- patternProperties: {
114084
- [ENTRY_NAME_PATTERN]: {
114085
- type: "object"
114086
- }
114087
- },
114088
- additionalProperties: false
114089
- }
114090
- }
114091
- ],
114092
- "@modern-js/plugin-swc": [
114093
- {
114094
- target: "tools.swc",
114095
- schema: {
114096
- typeof: [
114097
- "object"
114098
- ]
114099
- }
114100
- }
114101
- ],
114102
- "@modern-js/plugin-bff": [
114103
- {
114104
- target: "bff",
114105
- schema: {
114106
- type: "object",
114107
- properties: {
114108
- prefix: {
114109
- type: [
114110
- "string",
114111
- "array"
114112
- ],
114113
- items: {
114114
- type: "string"
114115
- }
114116
- },
114117
- fetcher: {
114118
- type: "string"
114119
- },
114120
- proxy: {
114121
- type: "object"
114122
- },
114123
- requestCreator: {
114124
- type: "string"
114125
- }
114126
- }
114127
- }
114128
- }
114129
- ],
114130
- "@modern-js/plugin-tailwindcss": [
114131
- {
114132
- target: "tools.tailwindcss",
114133
- schema: {
114134
- typeof: [
114135
- "object",
114136
- "function"
114137
- ]
114138
- }
114139
- }
114140
- ],
114141
- "@modern-js/plugin-proxy": [
114142
- {
114143
- target: "dev.proxy",
114144
- schema: {
114145
- typeof: [
114146
- "string",
114147
- "object"
114148
- ]
114149
- }
114150
- }
114151
- ],
114152
- "@modern-js/plugin-ssg": [
114153
- {
114154
- target: "output.ssg",
114155
- schema: {
114156
- oneOf: [
114157
- {
114158
- type: "boolean"
114159
- },
114160
- {
114161
- type: "object"
114162
- },
114163
- {
114164
- instanceof: "Function"
114165
- }
114166
- ]
114167
- }
114168
- }
114169
- ],
114170
- "@modern-js/plugin-state": [
114171
- {
114172
- target: "runtime.state",
114173
- schema: {
114174
- type: [
114175
- "boolean",
114176
- "object"
114177
- ]
114178
- }
114179
- }
114180
- ],
114181
- "@modern-js/plugin-design-token": [
114182
- // Legacy Features
114183
- {
114184
- target: "source.designSystem",
114185
- schema: {
114186
- typeof: [
114187
- "object"
114188
- ]
114189
- }
114190
- },
114191
- {
114192
- target: "source.designSystem.supportStyledComponents",
114193
- schema: {
114194
- type: [
114195
- "boolean"
114196
- ]
114197
- }
114198
- },
114199
- {
114200
- target: "designSystem",
114201
- schema: {
114202
- typeof: [
114203
- "object"
114204
- ]
114205
- }
114206
- }
114207
- ],
114208
- "@modern-js/plugin-router": [
114209
- {
114210
- target: "runtime.router",
114211
- schema: {
114212
- type: [
114213
- "boolean",
114214
- "object"
114215
- ]
114216
- }
114217
- }
114218
- ],
114219
- "@modern-js/plugin-testing": [
114220
- {
114221
- target: "testing",
114222
- schema: {
114223
- typeof: [
114224
- "object"
114225
- ]
114226
- }
114227
- },
114228
- {
114229
- target: "tools.jest",
114230
- schema: {
114231
- typeof: [
114232
- "object",
114233
- "function"
114234
- ]
114235
- }
114236
- }
114237
- ],
114238
- "@modern-js/plugin-garfish": [
114239
- {
114240
- target: "runtime.masterApp",
114241
- schema: {
114242
- type: [
114243
- "boolean",
114244
- "object"
114245
- ]
114246
- }
114247
- },
114248
- {
114249
- target: "dev.withMasterApp",
114250
- schema: {
114251
- type: [
114252
- "object"
114253
- ]
114254
- }
114255
- },
114256
- {
114257
- target: "deploy.microFrontend",
114258
- schema: {
114259
- type: [
114260
- "boolean",
114261
- "object"
114262
- ]
114263
- }
114264
- }
114265
- ],
114266
- "@modern-js/plugin-nocode": [],
114267
- "@modern-js/plugin-worker": [
114268
- {
114269
- target: "deploy.worker.ssr",
114270
- schema: {
114271
- type: [
114272
- "boolean"
114273
- ]
114274
- }
114275
- }
114276
- ]
114277
- };
114278
114075
  var DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
114279
114076
  allowNamespaces: true,
114280
114077
  allExtensions: true,
@@ -114704,6 +114501,7 @@ var require_project = __commonJS({
114704
114501
  });
114705
114502
  var _interop_require_default = require_interop_require_default();
114706
114503
  var _path = /* @__PURE__ */ _interop_require_default._(require("path"));
114504
+ var _pkgup = /* @__PURE__ */ _interop_require_default._(require_pkg_up2());
114707
114505
  var _commands = require_commands();
114708
114506
  var _compiled = require_compiled();
114709
114507
  var _common = require_common2();
@@ -114729,19 +114527,24 @@ var require_project = __commonJS({
114729
114527
  return false;
114730
114528
  }
114731
114529
  };
114732
- var isApiOnly = (appDirectory, entryDir) => __async(exports, null, function* () {
114733
- const srcDir = _path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
114734
- const existSrc = yield _compiled.fs.pathExists(srcDir);
114530
+ var isApiOnly = (appDirectory, entryDir, apiDir) => __async(exports, null, function* () {
114531
+ const existApi = yield _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
114532
+ const existSrc = yield _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
114735
114533
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
114736
- return !existSrc || Boolean(options["api-only"]);
114534
+ if (options["api-only"]) {
114535
+ return true;
114536
+ }
114537
+ return existApi && !existSrc;
114737
114538
  });
114738
114539
  var isWebOnly = () => __async(exports, null, function* () {
114739
114540
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
114740
114541
  return Boolean(options["web-only"]);
114741
114542
  });
114742
114543
  var isBeyondReact17 = (cwd) => {
114743
- const pkgPath = _path.default.join(cwd, "package.json");
114744
- if (!_compiled.fs.existsSync(pkgPath)) {
114544
+ const pkgPath = _pkgup.default.sync({
114545
+ cwd
114546
+ });
114547
+ if (!pkgPath) {
114745
114548
  return false;
114746
114549
  }
114747
114550
  const pkgInfo = JSON.parse(_compiled.fs.readFileSync(pkgPath, "utf8"));
@@ -115067,21 +114870,6 @@ var require_get2 = __commonJS({
115067
114870
  }
115068
114871
  });
115069
114872
 
115070
- // ../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs
115071
- var require_define_property = __commonJS({
115072
- "../../../../node_modules/.pnpm/@swc+helpers@0.5.1/node_modules/@swc/helpers/cjs/_define_property.cjs"(exports) {
115073
- "use strict";
115074
- exports._ = exports._define_property = _define_property14;
115075
- function _define_property14(obj, key, value) {
115076
- if (key in obj) {
115077
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
115078
- } else
115079
- obj[key] = value;
115080
- return obj;
115081
- }
115082
- }
115083
- });
115084
-
115085
114873
  // ../../../toolkit/utils/dist/cjs/cli/logger.js
115086
114874
  var require_logger2 = __commonJS({
115087
114875
  "../../../toolkit/utils/dist/cjs/cli/logger.js"(exports) {
@@ -115104,7 +114892,6 @@ var require_logger2 = __commonJS({
115104
114892
  return logger;
115105
114893
  }
115106
114894
  });
115107
- var _define_property14 = require_define_property();
115108
114895
  var _interop_require_default = require_interop_require_default();
115109
114896
  var _chalk = /* @__PURE__ */ _interop_require_default._(require_chalk2());
115110
114897
  var LOG_LEVEL = {
@@ -115190,10 +114977,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
115190
114977
  return longestLabel;
115191
114978
  }
115192
114979
  constructor(options = {}) {
115193
- _define_property14._(this, "level", void 0);
115194
- _define_property14._(this, "config", void 0);
115195
- _define_property14._(this, "types", void 0);
115196
- _define_property14._(this, "longestLabel", void 0);
115197
114980
  this.level = options.level || LOG_TYPES.log.level;
115198
114981
  this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
115199
114982
  this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
@@ -116123,31 +115906,6 @@ var require_runtimeExports = __commonJS({
116123
115906
  }
116124
115907
  });
116125
115908
 
116126
- // ../../../toolkit/utils/dist/cjs/cli/test.js
116127
- var require_test = __commonJS({
116128
- "../../../toolkit/utils/dist/cjs/cli/test.js"(exports) {
116129
- "use strict";
116130
- Object.defineProperty(exports, "__esModule", {
116131
- value: true
116132
- });
116133
- Object.defineProperty(exports, "initSnapshotSerializer", {
116134
- enumerable: true,
116135
- get: function() {
116136
- return initSnapshotSerializer;
116137
- }
116138
- });
116139
- var initSnapshotSerializer = (root) => {
116140
- expect.addSnapshotSerializer({
116141
- test: (val) => typeof val === "string" && (val.includes("modern.js") || val.includes("node_modules") || val.includes(root)),
116142
- print: (val) => (
116143
- // eslint-disable-next-line no-nested-ternary
116144
- 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
116145
- )
116146
- });
116147
- };
116148
- }
116149
- });
116150
-
116151
115909
  // ../../../toolkit/utils/dist/cjs/cli/watch.js
116152
115910
  var require_watch = __commonJS({
116153
115911
  "../../../toolkit/utils/dist/cjs/cli/watch.js"(exports) {
@@ -116244,7 +116002,6 @@ var require_cli = __commonJS({
116244
116002
  _export_star._(require_require(), exports);
116245
116003
  _export_star._(require_routes(), exports);
116246
116004
  _export_star._(require_runtimeExports(), exports);
116247
- _export_star._(require_test(), exports);
116248
116005
  _export_star._(require_watch(), exports);
116249
116006
  }
116250
116007
  });
@@ -131181,7 +130938,7 @@ var ZH_LOCALE2 = {
131181
130938
  function: {
131182
130939
  self: "启用可选功能",
131183
130940
  question: "请选择功能名称",
131184
- tailwindcss: "启用 「Tailwind CSS」 支持",
130941
+ tailwindcss: "启用「Tailwind CSS」 支持",
131185
130942
  bff: "启用「BFF」功能",
131186
130943
  micro_frontend: "启用「微前端」模式",
131187
130944
  i18n: "启用「国际化(i18n)」功能",
@@ -131536,8 +131293,6 @@ module.exports = {
131536
131293
  }
131537
131294
  generator.logger.debug(`forge @modern-js/ssg-generator succeed `);
131538
131295
  });
131539
- // Annotate the CommonJS export names for ESM import in node:
131540
- 0 && (module.exports = {});
131541
131296
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
131542
131297
  /*!
131543
131298
  * 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": [
@@ -29,17 +29,18 @@
29
29
  "@types/node": "^14",
30
30
  "jest": "^29",
31
31
  "typescript": "^5",
32
- "@modern-js/dependence-generator": "3.1.21",
33
- "@modern-js/plugin-i18n": "2.22.1",
34
- "@modern-js/generator-common": "3.1.21",
35
- "@modern-js/generator-utils": "3.1.21",
36
- "@scripts/jest-config": "2.22.1",
37
- "@scripts/build": "2.22.1"
32
+ "@modern-js/generator-common": "3.1.23",
33
+ "@modern-js/generator-utils": "3.1.23",
34
+ "@modern-js/dependence-generator": "3.1.23",
35
+ "@modern-js/plugin-i18n": "2.23.1",
36
+ "@scripts/build": "2.23.1",
37
+ "@scripts/jest-config": "2.23.1"
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": {