@modern-js/app-tools 0.0.0-nightly-20240304170717 → 0.0.0-nightly-20240305170715

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.
@@ -33,6 +33,7 @@ __export(adapterSSR_exports, {
33
33
  module.exports = __toCommonJS(adapterSSR_exports);
34
34
  var path = __toESM(require("path"));
35
35
  var import_shared = require("@rsbuild/shared");
36
+ var import_core = require("@rsbuild/core");
36
37
  var import_utils = require("@modern-js/utils");
37
38
  var import_bundlerPlugins = require("../bundlerPlugins");
38
39
  var import_utils2 = require("../../../analyze/utils");
@@ -42,7 +43,7 @@ const builderPluginAdapterSSR = (options) => ({
42
43
  const { normalizedConfig } = options;
43
44
  api.modifyRsbuildConfig((config) => {
44
45
  if (isStreamingSSR(normalizedConfig)) {
45
- return (0, import_shared.mergeRsbuildConfig)(config, {
46
+ return (0, import_core.mergeRsbuildConfig)(config, {
46
47
  html: {
47
48
  inject: "body"
48
49
  }
@@ -1,7 +1,8 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
2
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
3
  import * as path from "path";
4
- import { isHtmlDisabled, mergeRsbuildConfig } from "@rsbuild/shared";
4
+ import { isHtmlDisabled } from "@rsbuild/shared";
5
+ import { mergeRsbuildConfig } from "@rsbuild/core";
5
6
  import { isSSR, fs } from "@modern-js/utils";
6
7
  import { HtmlAsyncChunkPlugin, RouterPlugin } from "../bundlerPlugins";
7
8
  import { getServerCombinedModueFile } from "../../../analyze/utils";
@@ -1,5 +1,6 @@
1
1
  import * as path from "path";
2
- import { isHtmlDisabled, mergeRsbuildConfig } from "@rsbuild/shared";
2
+ import { isHtmlDisabled } from "@rsbuild/shared";
3
+ import { mergeRsbuildConfig } from "@rsbuild/core";
3
4
  import { isSSR, fs } from "@modern-js/utils";
4
5
  import { HtmlAsyncChunkPlugin, RouterPlugin } from "../bundlerPlugins";
5
6
  import { getServerCombinedModueFile } from "../../../analyze/utils";
@@ -1,3 +1,3 @@
1
1
  import type { AppLegacyNormalizedConfig, AppLegacyUserConfig, AppNormalizedConfig, AppUserConfig } from '../../types';
2
2
  export declare function transformNormalizedConfig(config: AppLegacyNormalizedConfig): AppNormalizedConfig<'webpack'>;
3
- export declare function checkIsLegacyConfig(config: AppLegacyUserConfig | AppUserConfig): config is AppLegacyUserConfig;
3
+ export declare function checkIsLegacyConfig(config: AppLegacyUserConfig | AppUserConfig<'shared'>): config is AppLegacyUserConfig;
@@ -4,7 +4,7 @@ import type { AppLegacyUserConfig, AppUserConfig } from './types';
4
4
  * This function helps you to autocomplete configuration types.
5
5
  * It accepts a direct config object, or a function that returns a config.
6
6
  */
7
- export declare const defineConfig: <B extends "rspack" | "webpack" = "webpack">(config: UserConfigExport<AppUserConfig<B_1>>) => UserConfigExport<AppUserConfig<B_1>>;
7
+ export declare const defineConfig: <B extends "rspack" | "webpack" = "webpack">(config: UserConfigExport<AppUserConfig<B>>) => UserConfigExport<AppUserConfig<B>>;
8
8
  /**
9
9
  * @deprecated Please use `defineConfig` instead.
10
10
  * `defineLegacyConfig` will be removed in the future major version.
@@ -1,5 +1,6 @@
1
1
  import type { ServerUserConfig, BffUserConfig } from '@modern-js/server-core';
2
2
  import type { UniBuilderPlugin } from '@modern-js/uni-builder';
3
+ import type { Bundler } from '../utils';
3
4
  import type { OutputUserConfig } from './output';
4
5
  import type { SourceUserConfig } from './source';
5
6
  import type { TestingUserConfig } from './testing';
@@ -17,7 +18,7 @@ export interface RuntimeUserConfig {
17
18
  export interface RuntimeByEntriesUserConfig {
18
19
  [name: string]: RuntimeUserConfig;
19
20
  }
20
- export interface AppToolsUserConfig {
21
+ export interface AppToolsUserConfig<B extends Bundler> {
21
22
  server?: ServerUserConfig;
22
23
  source?: SourceUserConfig;
23
24
  output?: OutputUserConfig;
@@ -33,7 +34,7 @@ export interface AppToolsUserConfig {
33
34
  runtime?: RuntimeUserConfig;
34
35
  runtimeByEntries?: RuntimeByEntriesUserConfig;
35
36
  html?: HtmlUserConfig;
36
- tools?: ToolsUserConfig;
37
+ tools?: ToolsUserConfig<B>;
37
38
  security?: SecurityUserConfig;
38
39
  testing?: TestingUserConfig;
39
40
  builderPlugins?: UniBuilderPlugin[];
@@ -44,4 +45,4 @@ interface SharedNormalizedConfig<RawConfig> {
44
45
  cliOptions?: Record<string, any>;
45
46
  _raw: RawConfig;
46
47
  }
47
- export type AppToolsNormalizedConfig<Config = AppToolsUserConfig> = Required<Config> & SharedNormalizedConfig<Config>;
48
+ export type AppToolsNormalizedConfig<Config = AppToolsUserConfig<'shared'>> = Required<Config> & SharedNormalizedConfig<Config>;
@@ -2,9 +2,10 @@ import type { JestConfig } from '@modern-js/types';
2
2
  import type { PluginSwcOptions } from '@rsbuild/plugin-swc';
3
3
  import type { PluginEsbuildOptions } from '@rsbuild/plugin-esbuild';
4
4
  import type { UniBuilderConfig } from '@modern-js/uni-builder';
5
- import type { UnwrapBuilderConfig } from '../utils';
5
+ import type { UnwrapBuilderConfig, Bundler } from '../utils';
6
6
  export type Tailwindcss = Record<string, any> | ((options: Record<string, any>) => Record<string, any> | void);
7
- export interface ToolsUserConfig extends UnwrapBuilderConfig<UniBuilderConfig, 'tools'> {
7
+ type BuilderToolsConfig = UnwrapBuilderConfig<UniBuilderConfig, 'tools'>;
8
+ export interface ToolsUserConfig<B extends Bundler = 'webpack'> extends Omit<BuilderToolsConfig, 'swc'> {
8
9
  /**
9
10
  * Used to custom Tailwind CSS configurations.
10
11
  * @requires `tailwindcss` plugin.
@@ -25,7 +26,7 @@ export interface ToolsUserConfig extends UnwrapBuilderConfig<UniBuilderConfig, '
25
26
  * The configuration of `swc` is provided by `swc` plugin.
26
27
  * Please use `yarn new` or `pnpm new` to enable the corresponding capability.
27
28
  */
28
- swc?: PluginSwcOptions<'outer'>;
29
+ swc?: B extends 'shared' ? undefined : B extends 'webpack' ? PluginSwcOptions<'outer'> : BuilderToolsConfig['swc'];
29
30
  /**
30
31
  * Used to custom Esbuild configurations.
31
32
  * @requires `esbuild` plugin.
@@ -34,3 +35,4 @@ export interface ToolsUserConfig extends UnwrapBuilderConfig<UniBuilderConfig, '
34
35
  */
35
36
  esbuild?: PluginEsbuildOptions;
36
37
  }
38
+ export {};
@@ -12,8 +12,8 @@ export type { ServerUserConfig, ServerNormalizedConfig, BffUserConfig, BffNormal
12
12
  export type { IAppContext, PluginAPI, CliPlugin, NormalizedConfig, UserConfig, } from '@modern-js/core';
13
13
  export type AppTools<B extends Bundler = 'webpack'> = {
14
14
  hooks: AppToolsHooks<B>;
15
- userConfig: AppToolsUserConfig;
16
- normalizedConfig: AppToolsNormalizedConfig<AppToolsUserConfig>;
15
+ userConfig: AppToolsUserConfig<B>;
16
+ normalizedConfig: AppToolsNormalizedConfig<AppToolsUserConfig<'shared'>>;
17
17
  };
18
18
  export type LegacyAppTools = {
19
19
  hooks: AppToolsHooks;
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-nightly-20240304170717",
18
+ "version": "0.0.0-nightly-20240305170715",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -69,37 +69,37 @@
69
69
  "@babel/parser": "^7.22.15",
70
70
  "@babel/traverse": "^7.23.2",
71
71
  "@babel/types": "^7.23.0",
72
- "@rsbuild/plugin-esbuild": "0.4.8",
73
- "@rsbuild/plugin-node-polyfill": "0.4.8",
74
- "@rsbuild/shared": "0.4.8",
75
- "@rsbuild/core": "0.4.8",
72
+ "@rsbuild/plugin-esbuild": "0.4.11",
73
+ "@rsbuild/plugin-node-polyfill": "0.4.11",
74
+ "@rsbuild/shared": "0.4.11",
75
+ "@rsbuild/core": "0.4.11",
76
76
  "es-module-lexer": "^1.1.0",
77
77
  "esbuild": "0.17.19",
78
78
  "@swc/helpers": "0.5.3",
79
- "@modern-js/uni-builder": "0.0.0-nightly-20240304170717",
80
- "@modern-js/core": "0.0.0-nightly-20240304170717",
81
- "@modern-js/plugin": "0.0.0-nightly-20240304170717",
82
- "@modern-js/plugin-data-loader": "0.0.0-nightly-20240304170717",
83
- "@modern-js/plugin-i18n": "0.0.0-nightly-20240304170717",
84
- "@modern-js/plugin-lint": "0.0.0-nightly-20240304170717",
85
- "@modern-js/prod-server": "0.0.0-nightly-20240304170717",
86
- "@modern-js/node-bundle-require": "0.0.0-nightly-20240304170717",
87
- "@modern-js/server": "0.0.0-nightly-20240304170717",
88
- "@modern-js/types": "0.0.0-nightly-20240304170717",
89
- "@modern-js/server-utils": "0.0.0-nightly-20240304170717",
90
- "@modern-js/utils": "0.0.0-nightly-20240304170717",
91
- "@modern-js/server-core": "0.0.0-nightly-20240304170717"
79
+ "@modern-js/uni-builder": "0.0.0-nightly-20240305170715",
80
+ "@modern-js/core": "0.0.0-nightly-20240305170715",
81
+ "@modern-js/plugin": "0.0.0-nightly-20240305170715",
82
+ "@modern-js/plugin-data-loader": "0.0.0-nightly-20240305170715",
83
+ "@modern-js/plugin-i18n": "0.0.0-nightly-20240305170715",
84
+ "@modern-js/plugin-lint": "0.0.0-nightly-20240305170715",
85
+ "@modern-js/node-bundle-require": "0.0.0-nightly-20240305170715",
86
+ "@modern-js/prod-server": "0.0.0-nightly-20240305170715",
87
+ "@modern-js/server": "0.0.0-nightly-20240305170715",
88
+ "@modern-js/server-utils": "0.0.0-nightly-20240305170715",
89
+ "@modern-js/server-core": "0.0.0-nightly-20240305170715",
90
+ "@modern-js/utils": "0.0.0-nightly-20240305170715",
91
+ "@modern-js/types": "0.0.0-nightly-20240305170715"
92
92
  },
93
93
  "devDependencies": {
94
- "@rsbuild/plugin-swc": "0.4.8",
94
+ "@rsbuild/plugin-swc": "0.4.11",
95
95
  "@types/babel__traverse": "7.18.5",
96
96
  "@types/jest": "^29",
97
97
  "@types/node": "^14",
98
98
  "jest": "^29",
99
99
  "typescript": "^5",
100
100
  "webpack": "^5.89.0",
101
- "@scripts/build": "0.0.0-nightly-20240304170717",
102
- "@scripts/jest-config": "0.0.0-nightly-20240304170717"
101
+ "@scripts/build": "0.0.0-nightly-20240305170715",
102
+ "@scripts/jest-config": "0.0.0-nightly-20240305170715"
103
103
  },
104
104
  "sideEffects": false,
105
105
  "publishConfig": {