@modern-js/builder 3.8.3 → 3.9.1

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.
@@ -88,14 +88,15 @@ const pluginEnvironmentDefaults = (distPath = {})=>({
88
88
  });
89
89
  api.modifyBundlerChain(async (chain, { environment })=>{
90
90
  const isServiceWorker = environment.name === utils_js_namespaceObject.SERVICE_WORKER_ENVIRONMENT_NAME;
91
- if (isServiceWorker && true === chain.output.get('module')) chain.output.library({
92
- ...chain.output.get('library') || {},
93
- type: 'module'
94
- });
95
- else if (isServiceWorker) chain.output.library({
96
- ...chain.output.get('library') || {},
97
- type: 'commonjs2'
98
- });
91
+ if (isServiceWorker) {
92
+ const library = chain.output.get('library');
93
+ chain.output.library({
94
+ ...'string' == typeof library || Array.isArray(library) ? {
95
+ name: library
96
+ } : library,
97
+ type: true === chain.output.get('module') ? 'module' : 'commonjs2'
98
+ });
99
+ }
99
100
  });
100
101
  }
101
102
  });
@@ -40,7 +40,9 @@ const pluginManifest = ()=>({
40
40
  chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(RspackManifestPlugin, [
41
41
  {
42
42
  fileName: 'web' === target ? 'asset-manifest.json' : `asset-manifest-${target}.json`,
43
- publicPath,
43
+ ...'string' == typeof publicPath ? {
44
+ publicPath
45
+ } : {},
44
46
  generate: manifest_js_namespaceObject.generateManifest
45
47
  }
46
48
  ]);
@@ -56,14 +56,15 @@ const pluginEnvironmentDefaults = (distPath = {})=>({
56
56
  });
57
57
  api.modifyBundlerChain(async (chain, { environment })=>{
58
58
  const isServiceWorker = environment.name === SERVICE_WORKER_ENVIRONMENT_NAME;
59
- if (isServiceWorker && true === chain.output.get('module')) chain.output.library({
60
- ...chain.output.get('library') || {},
61
- type: 'module'
62
- });
63
- else if (isServiceWorker) chain.output.library({
64
- ...chain.output.get('library') || {},
65
- type: 'commonjs2'
66
- });
59
+ if (isServiceWorker) {
60
+ const library = chain.output.get('library');
61
+ chain.output.library({
62
+ ...'string' == typeof library || Array.isArray(library) ? {
63
+ name: library
64
+ } : library,
65
+ type: true === chain.output.get('module') ? 'module' : 'commonjs2'
66
+ });
67
+ }
67
68
  });
68
69
  }
69
70
  });
@@ -8,7 +8,9 @@ const pluginManifest = ()=>({
8
8
  chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(RspackManifestPlugin, [
9
9
  {
10
10
  fileName: 'web' === target ? 'asset-manifest.json' : `asset-manifest-${target}.json`,
11
- publicPath,
11
+ ...'string' == typeof publicPath ? {
12
+ publicPath
13
+ } : {},
12
14
  generate: generateManifest
13
15
  }
14
16
  ]);
@@ -57,14 +57,15 @@ const pluginEnvironmentDefaults = (distPath = {})=>({
57
57
  });
58
58
  api.modifyBundlerChain(async (chain, { environment })=>{
59
59
  const isServiceWorker = environment.name === SERVICE_WORKER_ENVIRONMENT_NAME;
60
- if (isServiceWorker && true === chain.output.get('module')) chain.output.library({
61
- ...chain.output.get('library') || {},
62
- type: 'module'
63
- });
64
- else if (isServiceWorker) chain.output.library({
65
- ...chain.output.get('library') || {},
66
- type: 'commonjs2'
67
- });
60
+ if (isServiceWorker) {
61
+ const library = chain.output.get('library');
62
+ chain.output.library({
63
+ ...'string' == typeof library || Array.isArray(library) ? {
64
+ name: library
65
+ } : library,
66
+ type: true === chain.output.get('module') ? 'module' : 'commonjs2'
67
+ });
68
+ }
68
69
  });
69
70
  }
70
71
  });
@@ -9,7 +9,9 @@ const pluginManifest = ()=>({
9
9
  chain.plugin(CHAIN_ID.PLUGIN.MANIFEST).use(RspackManifestPlugin, [
10
10
  {
11
11
  fileName: 'web' === target ? 'asset-manifest.json' : `asset-manifest-${target}.json`,
12
- publicPath,
12
+ ...'string' == typeof publicPath ? {
13
+ publicPath
14
+ } : {},
13
15
  generate: generateManifest
14
16
  }
15
17
  ]);
@@ -1,5 +1,5 @@
1
1
  import type { RsbuildConfig, RsbuildInstance, RsbuildPlugin } from '@rsbuild/core';
2
- import type { BuilderConfig, CreateBuilderCommonOptions, CreateBuilderOptions } from './types';
2
+ import type { BuilderConfig, CreateBuilderCommonOptions, CreateBuilderOptions } from './types.js';
3
3
  export declare function parseConfig(builderConfig: BuilderConfig, options: CreateBuilderCommonOptions): Promise<{
4
4
  rsbuildConfig: RsbuildConfig;
5
5
  rsbuildPlugins: RsbuildPlugin[];
@@ -1,8 +1,8 @@
1
- import { type BuilderInstance, createRspackBuilder } from './createBuilder';
2
- import type { CreateBuilderOptions } from './types';
1
+ import { type BuilderInstance, createRspackBuilder } from './createBuilder.js';
2
+ import type { CreateBuilderOptions } from './types.js';
3
3
  export type { CreateBuilderOptions, BuilderInstance };
4
- export type { BuilderConfig, BundlerType, ToolsDevServerConfig, MetaOptions, Stats, MultiStats, RspackConfig, CacheGroup, } from './types';
4
+ export type { BuilderConfig, BundlerType, ToolsDevServerConfig, MetaOptions, Stats, MultiStats, RspackConfig, CacheGroup, } from './types.js';
5
5
  export { createRspackBuilder as createBuilder };
6
6
  export { logger, type ConfigChain, type RsbuildPlugin, type RsbuildPlugins, type ChainIdentifier, type RspackChain, type Rspack, type RsbuildContext, type RsbuildConfig, type RsbuildTarget, type NormalizedConfig, } from '@rsbuild/core';
7
- export { RUNTIME_CHUNK_NAME, RUNTIME_CHUNK_REGEX, SERVICE_WORKER_ENVIRONMENT_NAME, isHtmlDisabled, castArray, } from './shared/utils';
8
- export { parseConfig as parseRspackConfig } from './createBuilder';
7
+ export { RUNTIME_CHUNK_NAME, RUNTIME_CHUNK_REGEX, SERVICE_WORKER_ENVIRONMENT_NAME, isHtmlDisabled, castArray, } from './shared/utils.js';
8
+ export { parseConfig as parseRspackConfig } from './createBuilder.js';
@@ -1,3 +1,3 @@
1
1
  import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { DistPath } from '../types';
2
+ import type { DistPath } from '../types.js';
3
3
  export declare const pluginEnvironmentDefaults: (distPath?: DistPath) => RsbuildPlugin;
@@ -1,3 +1,3 @@
1
1
  import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { ChainedGlobalVars } from '../types';
2
+ import type { ChainedGlobalVars } from '../types.js';
3
3
  export declare const pluginGlobalVars: (options?: ChainedGlobalVars) => RsbuildPlugin;
@@ -1,5 +1,5 @@
1
1
  import { type RsbuildPlugin } from '@rsbuild/core';
2
- import type { ToolsAutoprefixerConfig } from '../types';
2
+ import type { ToolsAutoprefixerConfig } from '../types.js';
3
3
  export interface PluginPostcssOptions {
4
4
  autoprefixer?: ToolsAutoprefixerConfig;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import type { DevConfig, ServerConfig } from '@rsbuild/core';
2
- import type { BuilderConfig, ToolsDevServerConfig } from '../types';
2
+ import type { BuilderConfig, ToolsDevServerConfig } from '../types.js';
3
3
  export declare const transformToRsbuildServerOptions: (dev: NonNullable<BuilderConfig["dev"]>, devServer: ToolsDevServerConfig, server?: BuilderConfig["server"]) => {
4
4
  rsbuildDev: DevConfig;
5
5
  rsbuildServer: ServerConfig;
@@ -1,5 +1,5 @@
1
1
  import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
2
- import type { BuilderConfig, CreateBuilderCommonOptions } from '../types';
2
+ import type { BuilderConfig, CreateBuilderCommonOptions } from '../types.js';
3
3
  /** Determine if a file path is a CSS module when disableCssModuleExtension is enabled. */
4
4
  export declare const isLooseCssModules: (path: string) => boolean;
5
5
  export declare function parseCommonConfig(builderConfig: BuilderConfig, options?: CreateBuilderCommonOptions): Promise<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modern-js/builder",
3
- "version": "3.8.3",
3
+ "version": "3.9.1",
4
4
  "description": "A builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,7 +26,7 @@
26
26
  "dist"
27
27
  ],
28
28
  "dependencies": {
29
- "@rsbuild/core": "2.2.0-rc.0",
29
+ "@rsbuild/core": "2.2.4",
30
30
  "@rsbuild/plugin-assets-retry": "2.0.2",
31
31
  "@rsbuild/plugin-check-syntax": "2.0.1",
32
32
  "@rsbuild/plugin-css-minimizer": "2.0.1",
@@ -57,18 +57,18 @@
57
57
  "rsbuild-plugin-rsc": "0.1.1",
58
58
  "rspack-manifest-plugin": "5.2.2",
59
59
  "ts-deepmerge": "7.0.3",
60
- "@modern-js/utils": "3.8.3"
60
+ "@modern-js/utils": "3.9.1"
61
61
  },
62
62
  "devDependencies": {
63
- "@rslib/core": "0.23.2",
63
+ "@rslib/core": "1.0.0",
64
64
  "@types/html-minifier-terser": "^7.0.2",
65
65
  "@types/lodash": "^4.17.24",
66
66
  "react": "^19.2.8",
67
67
  "terser": "^5.48.0",
68
68
  "typescript": "^5.3.0",
69
- "@modern-js/rslib": "2.68.10",
70
- "@modern-js/types": "3.8.3",
71
- "@scripts/rstest-config": "2.66.0"
69
+ "@modern-js/types": "3.9.1",
70
+ "@scripts/rstest-config": "2.66.0",
71
+ "@modern-js/rslib": "2.68.10"
72
72
  },
73
73
  "publishConfig": {
74
74
  "access": "public",