@modern-js/utils 2.22.1-alpha.3 → 2.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/cjs/cli/constants/index.js +0 -215
  3. package/dist/cjs/cli/index.js +0 -1
  4. package/dist/cjs/cli/is/project.js +7 -4
  5. package/dist/cjs/cli/logger.js +0 -5
  6. package/dist/cjs/cli/prettyInstructions.js +3 -2
  7. package/dist/cjs/runtime/nestedRoutes.js +3 -1
  8. package/dist/esm/cli/constants/index.js +0 -212
  9. package/dist/esm/cli/index.js +0 -1
  10. package/dist/esm/cli/is/project.js +7 -4
  11. package/dist/esm/cli/logger.js +0 -5
  12. package/dist/esm/cli/prettyInstructions.js +3 -2
  13. package/dist/esm/runtime/nestedRoutes.js +3 -1
  14. package/dist/types/cli/constants/index.d.ts +0 -121
  15. package/dist/types/cli/index.d.ts +0 -1
  16. package/dist/types/cli/is/project.d.ts +11 -1
  17. package/dist/types/runtime/nestedRoutes.d.ts +6 -2
  18. package/package.json +6 -11
  19. package/dist/FileSizeReporter.d.ts +0 -16
  20. package/dist/FileSizeReporter.js +0 -162
  21. package/dist/alias.d.ts +0 -25
  22. package/dist/alias.js +0 -108
  23. package/dist/analyzeProject.d.ts +0 -2
  24. package/dist/analyzeProject.js +0 -71
  25. package/dist/applyOptionsChain.d.ts +0 -3
  26. package/dist/applyOptionsChain.js +0 -58
  27. package/dist/babel.d.ts +0 -3
  28. package/dist/babel.js +0 -136
  29. package/dist/chainId.d.ts +0 -244
  30. package/dist/chainId.js +0 -196
  31. package/dist/cjs/cli/test.js +0 -19
  32. package/dist/clearConsole.d.ts +0 -1
  33. package/dist/clearConsole.js +0 -31
  34. package/dist/commands.d.ts +0 -4
  35. package/dist/commands.js +0 -48
  36. package/dist/compatRequire.d.ts +0 -13
  37. package/dist/compatRequire.js +0 -82
  38. package/dist/compiled.d.ts +0 -43
  39. package/dist/compiled.js +0 -142
  40. package/dist/constants.d.ts +0 -244
  41. package/dist/constants.js +0 -320
  42. package/dist/debug.d.ts +0 -6
  43. package/dist/debug.js +0 -28
  44. package/dist/emptyDir.d.ts +0 -1
  45. package/dist/emptyDir.js +0 -52
  46. package/dist/ensureAbsolutePath.d.ts +0 -7
  47. package/dist/ensureAbsolutePath.js +0 -38
  48. package/dist/ensureArray.d.ts +0 -1
  49. package/dist/ensureArray.js +0 -32
  50. package/dist/esm/cli/test.js +0 -9
  51. package/dist/findExists.d.ts +0 -6
  52. package/dist/findExists.js +0 -45
  53. package/dist/generateMetaTags.d.ts +0 -16
  54. package/dist/generateMetaTags.js +0 -61
  55. package/dist/getBrowserslist.d.ts +0 -2
  56. package/dist/getBrowserslist.js +0 -31
  57. package/dist/getCoreJsVersion.d.ts +0 -1
  58. package/dist/getCoreJsVersion.js +0 -46
  59. package/dist/getEntryOptions.d.ts +0 -1
  60. package/dist/getEntryOptions.js +0 -54
  61. package/dist/getPackageManager.d.ts +0 -1
  62. package/dist/getPackageManager.js +0 -87
  63. package/dist/getPort.d.ts +0 -14
  64. package/dist/getPort.js +0 -112
  65. package/dist/getServerConfig.d.ts +0 -1
  66. package/dist/getServerConfig.js +0 -67
  67. package/dist/getTargetDir.d.ts +0 -1
  68. package/dist/getTargetDir.js +0 -41
  69. package/dist/import.d.ts +0 -5
  70. package/dist/import.js +0 -33
  71. package/dist/index.d.ts +0 -44
  72. package/dist/index.js +0 -60
  73. package/dist/is/index.d.ts +0 -58
  74. package/dist/is/index.js +0 -114
  75. package/dist/is/nodeEnv.d.ts +0 -8
  76. package/dist/is/nodeEnv.js +0 -39
  77. package/dist/is/platform.d.ts +0 -2
  78. package/dist/is/platform.js +0 -30
  79. package/dist/is/type.d.ts +0 -8
  80. package/dist/is/type.js +0 -64
  81. package/dist/logger.d.ts +0 -65
  82. package/dist/logger.js +0 -145
  83. package/dist/monorepo.d.ts +0 -11
  84. package/dist/monorepo.js +0 -137
  85. package/dist/nodeEnv.d.ts +0 -3
  86. package/dist/nodeEnv.js +0 -81
  87. package/dist/path.d.ts +0 -18
  88. package/dist/path.js +0 -92
  89. package/dist/pathSerializer.d.ts +0 -16
  90. package/dist/pathSerializer.js +0 -76
  91. package/dist/plugin.d.ts +0 -2
  92. package/dist/plugin.js +0 -46
  93. package/dist/prettyInstructions.d.ts +0 -9
  94. package/dist/prettyInstructions.js +0 -112
  95. package/dist/printBuildError.d.ts +0 -8
  96. package/dist/printBuildError.js +0 -57
  97. package/dist/react.d.ts +0 -1
  98. package/dist/react.js +0 -64
  99. package/dist/readTsConfig.d.ts +0 -2
  100. package/dist/readTsConfig.js +0 -47
  101. package/dist/removeSlash.d.ts +0 -3
  102. package/dist/removeSlash.js +0 -33
  103. package/dist/resolve.d.ts +0 -13
  104. package/dist/resolve.js +0 -63
  105. package/dist/routes.d.ts +0 -2
  106. package/dist/routes.js +0 -58
  107. package/dist/runtimeExports.d.ts +0 -4
  108. package/dist/runtimeExports.js +0 -73
  109. package/dist/ssr.d.ts +0 -8
  110. package/dist/ssr.js +0 -30
  111. package/dist/storage.d.ts +0 -5
  112. package/dist/storage.js +0 -75
  113. package/dist/testUtils.d.ts +0 -5
  114. package/dist/testUtils.js +0 -38
  115. package/dist/types/cli/test.d.ts +0 -5
  116. package/dist/types.d.ts +0 -1
  117. package/dist/types.js +0 -15
  118. package/dist/universal/constants.d.ts +0 -9
  119. package/dist/universal/constants.js +0 -30
  120. package/dist/universal/formatWebpack.d.ts +0 -13
  121. package/dist/universal/formatWebpack.js +0 -100
  122. package/dist/universal/nestedRoutes.d.ts +0 -8
  123. package/dist/universal/nestedRoutes.js +0 -131
  124. package/dist/universal/remixRouter.d.ts +0 -1
  125. package/dist/universal/remixRouter.js +0 -17
  126. package/dist/universal/serialize.d.ts +0 -1
  127. package/dist/universal/serialize.js +0 -40
  128. package/dist/version.d.ts +0 -2
  129. package/dist/version.js +0 -92
  130. package/dist/wait.d.ts +0 -2
  131. package/dist/wait.js +0 -29
  132. package/dist/watch.d.ts +0 -8
  133. package/dist/watch.js +0 -90
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @modern-js/utils
2
2
 
3
+ ## 2.23.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7e6fb5f: chore: publishConfig add provenance config
8
+
9
+ chore: publishConfig 增加 provenance 配置
10
+
11
+ - a7a7ad7: chore: move some public code to the utils package
12
+ chore: 移动一些公共的代码到 utils 包
13
+ - 6dec7c2: test(utils): reuse the snapshot serializer of vitest config
14
+
15
+ test(utils): 复用 vitest 的 snapshot serializer
16
+
17
+ - c3216b5: chore: split the scheme into the plugin
18
+
19
+ chore: 拆分 scheme 到插件内部
20
+
21
+ ## 2.22.1
22
+
23
+ ### Patch Changes
24
+
25
+ - e2848a2: fix: support nonce in streaming SSR
26
+ fix: 在 streaming SSR 中支持 nonce
27
+ - d4045ed: fix(builder): print https URLs when devServer.https is true
28
+
29
+ fix(builder): 当 devServer.https 为 true 时,输出 https 的 URLs
30
+
3
31
  ## 2.22.0
4
32
 
5
33
  ### Patch Changes
@@ -100,9 +100,6 @@ _export(exports, {
100
100
  INTERNAL_SERVER_PLUGINS: function() {
101
101
  return INTERNAL_SERVER_PLUGINS;
102
102
  },
103
- PLUGIN_SCHEMAS: function() {
104
- return PLUGIN_SCHEMAS;
105
- },
106
103
  DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
107
104
  return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
108
105
  }
@@ -157,8 +154,6 @@ const INTERNAL_MODULE_TOOLS_PLUGINS = {
157
154
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
158
155
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
159
156
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
160
- // TODO: Maybe can remove it
161
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
162
157
  // legacy router (inner react-router-dom v5)
163
158
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
164
159
  };
@@ -189,8 +184,6 @@ const INTERNAL_CLI_PLUGINS = {
189
184
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
190
185
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
191
186
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
192
- // TODO: Maybe can remove it
193
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
194
187
  // legacy router (inner react-router-dom v5)
195
188
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
196
189
  };
@@ -206,214 +199,6 @@ const INTERNAL_SERVER_PLUGINS = {
206
199
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
207
200
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
208
201
  };
209
- const PLUGIN_SCHEMAS = {
210
- "@modern-js/runtime": [
211
- {
212
- target: "runtime",
213
- schema: {
214
- type: "object",
215
- additionalProperties: false
216
- }
217
- },
218
- {
219
- target: "runtimeByEntries",
220
- schema: {
221
- type: "object",
222
- patternProperties: {
223
- [ENTRY_NAME_PATTERN]: {
224
- type: "object"
225
- }
226
- },
227
- additionalProperties: false
228
- }
229
- }
230
- ],
231
- "@modern-js/plugin-swc": [
232
- {
233
- target: "tools.swc",
234
- schema: {
235
- typeof: [
236
- "object"
237
- ]
238
- }
239
- }
240
- ],
241
- "@modern-js/plugin-bff": [
242
- {
243
- target: "bff",
244
- schema: {
245
- type: "object",
246
- properties: {
247
- prefix: {
248
- type: [
249
- "string",
250
- "array"
251
- ],
252
- items: {
253
- type: "string"
254
- }
255
- },
256
- fetcher: {
257
- type: "string"
258
- },
259
- proxy: {
260
- type: "object"
261
- },
262
- requestCreator: {
263
- type: "string"
264
- }
265
- }
266
- }
267
- }
268
- ],
269
- "@modern-js/plugin-tailwindcss": [
270
- {
271
- target: "tools.tailwindcss",
272
- schema: {
273
- typeof: [
274
- "object",
275
- "function"
276
- ]
277
- }
278
- }
279
- ],
280
- "@modern-js/plugin-proxy": [
281
- {
282
- target: "dev.proxy",
283
- schema: {
284
- typeof: [
285
- "string",
286
- "object"
287
- ]
288
- }
289
- }
290
- ],
291
- "@modern-js/plugin-ssg": [
292
- {
293
- target: "output.ssg",
294
- schema: {
295
- oneOf: [
296
- {
297
- type: "boolean"
298
- },
299
- {
300
- type: "object"
301
- },
302
- {
303
- instanceof: "Function"
304
- }
305
- ]
306
- }
307
- }
308
- ],
309
- "@modern-js/plugin-state": [
310
- {
311
- target: "runtime.state",
312
- schema: {
313
- type: [
314
- "boolean",
315
- "object"
316
- ]
317
- }
318
- }
319
- ],
320
- "@modern-js/plugin-design-token": [
321
- // Legacy Features
322
- {
323
- target: "source.designSystem",
324
- schema: {
325
- typeof: [
326
- "object"
327
- ]
328
- }
329
- },
330
- {
331
- target: "source.designSystem.supportStyledComponents",
332
- schema: {
333
- type: [
334
- "boolean"
335
- ]
336
- }
337
- },
338
- {
339
- target: "designSystem",
340
- schema: {
341
- typeof: [
342
- "object"
343
- ]
344
- }
345
- }
346
- ],
347
- "@modern-js/plugin-router": [
348
- {
349
- target: "runtime.router",
350
- schema: {
351
- type: [
352
- "boolean",
353
- "object"
354
- ]
355
- }
356
- }
357
- ],
358
- "@modern-js/plugin-testing": [
359
- {
360
- target: "testing",
361
- schema: {
362
- typeof: [
363
- "object"
364
- ]
365
- }
366
- },
367
- {
368
- target: "tools.jest",
369
- schema: {
370
- typeof: [
371
- "object",
372
- "function"
373
- ]
374
- }
375
- }
376
- ],
377
- "@modern-js/plugin-garfish": [
378
- {
379
- target: "runtime.masterApp",
380
- schema: {
381
- type: [
382
- "boolean",
383
- "object"
384
- ]
385
- }
386
- },
387
- {
388
- target: "dev.withMasterApp",
389
- schema: {
390
- type: [
391
- "object"
392
- ]
393
- }
394
- },
395
- {
396
- target: "deploy.microFrontend",
397
- schema: {
398
- type: [
399
- "boolean",
400
- "object"
401
- ]
402
- }
403
- }
404
- ],
405
- "@modern-js/plugin-nocode": [],
406
- "@modern-js/plugin-worker": [
407
- {
408
- target: "deploy.worker.ssr",
409
- schema: {
410
- type: [
411
- "boolean"
412
- ]
413
- }
414
- }
415
- ]
416
- };
417
202
  const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
418
203
  allowNamespaces: true,
419
204
  allExtensions: true,
@@ -24,5 +24,4 @@ _export_star._(require("./print"), exports);
24
24
  _export_star._(require("./require"), exports);
25
25
  _export_star._(require("./routes"), exports);
26
26
  _export_star._(require("./runtimeExports"), exports);
27
- _export_star._(require("./test"), exports);
28
27
  _export_star._(require("./watch"), exports);
@@ -59,11 +59,14 @@ const isPackageInstalled = (name, resolvePaths) => {
59
59
  return false;
60
60
  }
61
61
  };
62
- const isApiOnly = async (appDirectory, entryDir) => {
63
- const srcDir = _path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
64
- const existSrc = await _compiled.fs.pathExists(srcDir);
62
+ const isApiOnly = async (appDirectory, entryDir, apiDir) => {
63
+ const existApi = await _compiled.fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : _path.default.join(appDirectory, "api"));
64
+ const existSrc = await _compiled.fs.pathExists(_path.default.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
65
65
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
66
- return !existSrc || Boolean(options["api-only"]);
66
+ if (options["api-only"]) {
67
+ return true;
68
+ }
69
+ return existApi && !existSrc;
67
70
  };
68
71
  const isWebOnly = async () => {
69
72
  const options = (0, _compiled.minimist)((0, _commands.getArgv)());
@@ -17,7 +17,6 @@ _export(exports, {
17
17
  return logger;
18
18
  }
19
19
  });
20
- const _define_property = require("@swc/helpers/_/_define_property");
21
20
  const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
22
21
  const _chalk = /* @__PURE__ */ _interop_require_default._(require("../../compiled/chalk"));
23
22
  const LOG_LEVEL = {
@@ -103,10 +102,6 @@ ${_chalk.default.grey(rest.join("\n"))}`;
103
102
  return longestLabel;
104
103
  }
105
104
  constructor(options = {}) {
106
- _define_property._(this, "level", void 0);
107
- _define_property._(this, "config", void 0);
108
- _define_property._(this, "types", void 0);
109
- _define_property._(this, "longestLabel", void 0);
110
105
  this.level = options.level || LOG_TYPES.log.level;
111
106
  this.config = {
112
107
  ...DEFAULT_CONFIG,
@@ -67,9 +67,10 @@ const getAddressUrls = (protocol = "http", port, host) => {
67
67
  }, []);
68
68
  };
69
69
  const prettyInstructions = (appContext, config) => {
70
- var _config_dev;
70
+ var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
71
71
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
72
- const urls = getAddressUrls(config.dev.https && (0, _is.isDev)() ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
72
+ const isHttps = (0, _is.isDev)() && ((_appContext_builder_context_devServer = (_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
73
+ const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
73
74
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
74
75
  let message = "App running at:\n\n";
75
76
  if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
@@ -72,7 +72,9 @@ const renderNestedRoute = (nestedRoute, options = {}) => {
72
72
  /* @__PURE__ */ (0, _jsxruntime.jsx)(Component, {
73
73
  ...props
74
74
  }),
75
- typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, _jsxruntime.jsx)(DeferredDataComponent, {})
75
+ typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ (0, _jsxruntime.jsx)(DeferredDataComponent, {
76
+ nonce: props === null || props === void 0 ? void 0 : props.nonce
77
+ })
76
78
  ]
77
79
  });
78
80
  } else if (lazyImport) {
@@ -46,8 +46,6 @@ export const INTERNAL_MODULE_TOOLS_PLUGINS = {
46
46
  "@modern-js/plugin-testing": "@modern-js/plugin-testing/cli",
47
47
  "@modern-js/plugin-storybook": "@modern-js/plugin-storybook/cli",
48
48
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
49
- // TODO: Maybe can remove it
50
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
51
49
  // legacy router (inner react-router-dom v5)
52
50
  "@modern-js/plugin-router-legacy": "@modern-js/plugin-router-legacy/cli"
53
51
  };
@@ -78,8 +76,6 @@ export const INTERNAL_CLI_PLUGINS = {
78
76
  "@modern-js/plugin-garfish": "@modern-js/plugin-garfish/cli",
79
77
  "@modern-js/plugin-tailwindcss": "@modern-js/plugin-tailwindcss/cli",
80
78
  "@modern-js/plugin-polyfill": "@modern-js/plugin-polyfill/cli",
81
- // TODO: Maybe can remove it
82
- "@modern-js/plugin-nocode": "@modern-js/plugin-nocode/cli",
83
79
  // legacy router (inner react-router-dom v5)
84
80
  "@modern-js/plugin-router-v5": "@modern-js/plugin-router-v5/cli"
85
81
  };
@@ -95,214 +91,6 @@ export const INTERNAL_SERVER_PLUGINS = {
95
91
  [SERVER_PLUGIN_SERVER]: "@modern-js/plugin-server/server",
96
92
  [SERVER_PLUGIN_POLYFILL]: "@modern-js/plugin-polyfill/server"
97
93
  };
98
- export const PLUGIN_SCHEMAS = {
99
- "@modern-js/runtime": [
100
- {
101
- target: "runtime",
102
- schema: {
103
- type: "object",
104
- additionalProperties: false
105
- }
106
- },
107
- {
108
- target: "runtimeByEntries",
109
- schema: {
110
- type: "object",
111
- patternProperties: {
112
- [ENTRY_NAME_PATTERN]: {
113
- type: "object"
114
- }
115
- },
116
- additionalProperties: false
117
- }
118
- }
119
- ],
120
- "@modern-js/plugin-swc": [
121
- {
122
- target: "tools.swc",
123
- schema: {
124
- typeof: [
125
- "object"
126
- ]
127
- }
128
- }
129
- ],
130
- "@modern-js/plugin-bff": [
131
- {
132
- target: "bff",
133
- schema: {
134
- type: "object",
135
- properties: {
136
- prefix: {
137
- type: [
138
- "string",
139
- "array"
140
- ],
141
- items: {
142
- type: "string"
143
- }
144
- },
145
- fetcher: {
146
- type: "string"
147
- },
148
- proxy: {
149
- type: "object"
150
- },
151
- requestCreator: {
152
- type: "string"
153
- }
154
- }
155
- }
156
- }
157
- ],
158
- "@modern-js/plugin-tailwindcss": [
159
- {
160
- target: "tools.tailwindcss",
161
- schema: {
162
- typeof: [
163
- "object",
164
- "function"
165
- ]
166
- }
167
- }
168
- ],
169
- "@modern-js/plugin-proxy": [
170
- {
171
- target: "dev.proxy",
172
- schema: {
173
- typeof: [
174
- "string",
175
- "object"
176
- ]
177
- }
178
- }
179
- ],
180
- "@modern-js/plugin-ssg": [
181
- {
182
- target: "output.ssg",
183
- schema: {
184
- oneOf: [
185
- {
186
- type: "boolean"
187
- },
188
- {
189
- type: "object"
190
- },
191
- {
192
- instanceof: "Function"
193
- }
194
- ]
195
- }
196
- }
197
- ],
198
- "@modern-js/plugin-state": [
199
- {
200
- target: "runtime.state",
201
- schema: {
202
- type: [
203
- "boolean",
204
- "object"
205
- ]
206
- }
207
- }
208
- ],
209
- "@modern-js/plugin-design-token": [
210
- // Legacy Features
211
- {
212
- target: "source.designSystem",
213
- schema: {
214
- typeof: [
215
- "object"
216
- ]
217
- }
218
- },
219
- {
220
- target: "source.designSystem.supportStyledComponents",
221
- schema: {
222
- type: [
223
- "boolean"
224
- ]
225
- }
226
- },
227
- {
228
- target: "designSystem",
229
- schema: {
230
- typeof: [
231
- "object"
232
- ]
233
- }
234
- }
235
- ],
236
- "@modern-js/plugin-router": [
237
- {
238
- target: "runtime.router",
239
- schema: {
240
- type: [
241
- "boolean",
242
- "object"
243
- ]
244
- }
245
- }
246
- ],
247
- "@modern-js/plugin-testing": [
248
- {
249
- target: "testing",
250
- schema: {
251
- typeof: [
252
- "object"
253
- ]
254
- }
255
- },
256
- {
257
- target: "tools.jest",
258
- schema: {
259
- typeof: [
260
- "object",
261
- "function"
262
- ]
263
- }
264
- }
265
- ],
266
- "@modern-js/plugin-garfish": [
267
- {
268
- target: "runtime.masterApp",
269
- schema: {
270
- type: [
271
- "boolean",
272
- "object"
273
- ]
274
- }
275
- },
276
- {
277
- target: "dev.withMasterApp",
278
- schema: {
279
- type: [
280
- "object"
281
- ]
282
- }
283
- },
284
- {
285
- target: "deploy.microFrontend",
286
- schema: {
287
- type: [
288
- "boolean",
289
- "object"
290
- ]
291
- }
292
- }
293
- ],
294
- "@modern-js/plugin-nocode": [],
295
- "@modern-js/plugin-worker": [
296
- {
297
- target: "deploy.worker.ssr",
298
- schema: {
299
- type: [
300
- "boolean"
301
- ]
302
- }
303
- }
304
- ]
305
- };
306
94
  export const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
307
95
  allowNamespaces: true,
308
96
  allExtensions: true,
@@ -19,5 +19,4 @@ export * from "./print";
19
19
  export * from "./require";
20
20
  export * from "./routes";
21
21
  export * from "./runtimeExports";
22
- export * from "./test";
23
22
  export * from "./watch";
@@ -24,11 +24,14 @@ export const isPackageInstalled = (name, resolvePaths) => {
24
24
  return false;
25
25
  }
26
26
  };
27
- export const isApiOnly = async (appDirectory, entryDir) => {
28
- const srcDir = path.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src");
29
- const existSrc = await fs.pathExists(srcDir);
27
+ export const isApiOnly = async (appDirectory, entryDir, apiDir) => {
28
+ const existApi = await fs.pathExists(apiDir !== null && apiDir !== void 0 ? apiDir : path.join(appDirectory, "api"));
29
+ const existSrc = await fs.pathExists(path.join(appDirectory, entryDir !== null && entryDir !== void 0 ? entryDir : "src"));
30
30
  const options = minimist(getArgv());
31
- return !existSrc || Boolean(options["api-only"]);
31
+ if (options["api-only"]) {
32
+ return true;
33
+ }
34
+ return existApi && !existSrc;
32
35
  };
33
36
  export const isWebOnly = async () => {
34
37
  const options = minimist(getArgv());
@@ -1,4 +1,3 @@
1
- import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
1
  import chalk from "../../compiled/chalk";
3
2
  const LOG_LEVEL = {
4
3
  error: 0,
@@ -83,10 +82,6 @@ ${chalk.grey(rest.join("\n"))}`;
83
82
  return longestLabel;
84
83
  }
85
84
  constructor(options = {}) {
86
- _define_property(this, "level", void 0);
87
- _define_property(this, "config", void 0);
88
- _define_property(this, "types", void 0);
89
- _define_property(this, "longestLabel", void 0);
90
85
  this.level = options.level || LOG_TYPES.log.level;
91
86
  this.config = {
92
87
  ...DEFAULT_CONFIG,
@@ -47,9 +47,10 @@ export const getAddressUrls = (protocol = "http", port, host) => {
47
47
  }, []);
48
48
  };
49
49
  export const prettyInstructions = (appContext, config) => {
50
- var _config_dev;
50
+ var _appContext_builder_context_devServer, _appContext_builder, _config_dev;
51
51
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
52
- const urls = getAddressUrls(config.dev.https && isDev() ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
52
+ const isHttps = isDev() && ((_appContext_builder_context_devServer = (_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
53
+ const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
53
54
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
54
55
  let message = "App running at:\n\n";
55
56
  if (isSingleEntry(entrypoints) || apiOnly) {
@@ -52,7 +52,9 @@ export const renderNestedRoute = (nestedRoute, options = {}) => {
52
52
  /* @__PURE__ */ _jsx(Component, {
53
53
  ...props
54
54
  }),
55
- typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ _jsx(DeferredDataComponent, {})
55
+ typeof document === "undefined" && DeferredDataComponent && /* @__PURE__ */ _jsx(DeferredDataComponent, {
56
+ nonce: props === null || props === void 0 ? void 0 : props.nonce
57
+ })
56
58
  ]
57
59
  });
58
60
  } else if (lazyImport) {