@rsbuild/core 1.3.0-beta.0 → 1.3.0-beta.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.
@@ -1,4 +1,3 @@
1
- import type { ChokidarOptions } from '../compiled/chokidar/index.js';
2
1
  import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from './types';
3
2
  export declare function getDefaultEntry(root: string): RsbuildEntry;
4
3
  export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
@@ -25,7 +24,6 @@ export declare function defineConfig(config: RsbuildConfig): RsbuildConfig;
25
24
  export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
26
25
  export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
27
26
  export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
28
- export declare function watchFilesForRestart(files: string[], root: string, isBuildWatch: boolean, watchOptions?: ChokidarOptions): Promise<void>;
29
27
  export type LoadConfigOptions = {
30
28
  /**
31
29
  * The root path to resolve the config file.
@@ -22,12 +22,20 @@ export declare const CHAIN_ID: {
22
22
  readonly TS: "ts";
23
23
  /** Rule for CSS */
24
24
  readonly CSS: "css";
25
- /** Rule for less */
25
+ /** Rule for raw CSS */
26
+ readonly CSS_RAW: "css-raw";
27
+ /** Rule for Less */
26
28
  readonly LESS: "less";
27
- /** Rule for sass */
29
+ /** Rule for raw Less */
30
+ readonly LESS_RAW: "less-raw";
31
+ /** Rule for Sass */
28
32
  readonly SASS: "sass";
33
+ /** Rule for raw Sass */
34
+ readonly SASS_RAW: "sass-raw";
29
35
  /** Rule for stylus */
30
36
  readonly STYLUS: "stylus";
37
+ /** Rule for raw stylus */
38
+ readonly STYLUS_RAW: "stylus-raw";
31
39
  /** Rule for svg */
32
40
  readonly SVG: "svg";
33
41
  /** Rule for pug */
@@ -33,7 +33,6 @@ export declare function getFilename(config: NormalizedConfig | NormalizedEnviron
33
33
  export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
34
34
  export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
35
35
  export declare const upperFirst: (str: string) => string;
36
- export declare function debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
37
36
  export declare const isURL: (str: string) => boolean;
38
37
  export declare const createVirtualModule: (content: string) => string;
39
38
  export declare function isWebTarget(target: RsbuildTarget | RsbuildTarget[]): boolean;
@@ -0,0 +1,18 @@
1
+ import type { ChokidarOptions } from '../compiled/chokidar/index.js';
2
+ import type { RsbuildInstance } from './types';
3
+ type Cleaner = () => Promise<unknown> | unknown;
4
+ /**
5
+ * Add a cleaner to handle side effects
6
+ */
7
+ export declare const onBeforeRestartServer: (cleaner: Cleaner) => void;
8
+ export declare const restartDevServer: ({ filePath, clear, }?: {
9
+ filePath?: string;
10
+ clear?: boolean;
11
+ }) => Promise<boolean>;
12
+ export declare function watchFilesForRestart({ files, rsbuild, isBuildWatch, watchOptions, }: {
13
+ files: string[];
14
+ rsbuild: RsbuildInstance;
15
+ isBuildWatch: boolean;
16
+ watchOptions?: ChokidarOptions;
17
+ }): Promise<void>;
18
+ export {};
@@ -5,6 +5,6 @@ export declare function setupCliShortcuts({ help, openPage, closeServer, printUr
5
5
  openPage: () => Promise<void>;
6
6
  closeServer: () => Promise<void>;
7
7
  printUrls: () => void;
8
- restartServer?: () => Promise<void>;
8
+ restartServer?: () => Promise<boolean>;
9
9
  customShortcuts?: (shortcuts: CliShortcut[]) => CliShortcut[];
10
10
  }): () => void;
@@ -19,6 +19,16 @@ export type RsbuildContext = {
19
19
  port: number;
20
20
  https: boolean;
21
21
  };
22
+ /**
23
+ * The current action type.
24
+ * - dev: will be set when running `rsbuild dev` or `rsbuild.startDevServer()`
25
+ * - build: will be set when running `rsbuild build` or `rsbuild.build()`
26
+ * - preview: will be set when running `rsbuild preview` or `rsbuild.preview()`
27
+ */
28
+ action?: 'dev' | 'build' | 'preview';
29
+ /**
30
+ * The bundler type, can be `rspack` or `webpack`.
31
+ */
22
32
  bundlerType: BundlerType;
23
33
  };
24
34
  /** The inner context. */
@@ -41,12 +51,4 @@ export type InternalContext = RsbuildContext & {
41
51
  environments: Record<string, EnvironmentContext>;
42
52
  /** Only build specified environment. */
43
53
  specifiedEnvironments?: string[];
44
- /**
45
- * The command type.
46
- *
47
- * - dev: `rsbuild dev` or `rsbuild.startDevServer()`
48
- * - build: `rsbuild build` or `rsbuild.build()`
49
- * - preview: `rsbuild preview` or `rsbuild.preview()`
50
- */
51
- command?: 'dev' | 'build' | 'preview';
52
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.3.0-beta.0",
3
+ "version": "1.3.0-beta.1",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -83,7 +83,7 @@
83
83
  "reduce-configs": "^1.1.0",
84
84
  "rsbuild-dev-middleware": "0.2.0",
85
85
  "rslog": "^1.2.3",
86
- "rspack-chain": "^1.2.1",
86
+ "rspack-chain": "^1.2.2",
87
87
  "rspack-manifest-plugin": "5.0.3",
88
88
  "sirv": "^3.0.1",
89
89
  "style-loader": "3.3.4",
package/types.d.ts CHANGED
@@ -184,6 +184,34 @@ declare module '*?inline' {
184
184
  export default content;
185
185
  }
186
186
 
187
+ /**
188
+ * Raw css
189
+ */
190
+ declare module '*.css?raw' {
191
+ const content: string;
192
+ export default content;
193
+ }
194
+ declare module '*.scss?raw' {
195
+ const content: string;
196
+ export default content;
197
+ }
198
+ declare module '*.sass?raw' {
199
+ const content: string;
200
+ export default content;
201
+ }
202
+ declare module '*.less?raw' {
203
+ const content: string;
204
+ export default content;
205
+ }
206
+ declare module '*.styl?raw' {
207
+ const content: string;
208
+ export default content;
209
+ }
210
+ declare module '*.stylus?raw' {
211
+ const content: string;
212
+ export default content;
213
+ }
214
+
187
215
  /**
188
216
  * CSS Modules
189
217
  */
@@ -1 +0,0 @@
1
- export declare function prepareCli(): void;
@@ -1,14 +0,0 @@
1
- type Cleaner = () => Promise<unknown> | unknown;
2
- /**
3
- * Add a cleaner to handle side effects
4
- */
5
- export declare const onBeforeRestartServer: (cleaner: Cleaner) => void;
6
- export declare const restartDevServer: ({ filePath, clear, }?: {
7
- filePath?: string;
8
- clear?: boolean;
9
- }) => Promise<void>;
10
- export declare const restartBuild: ({ filePath, clear, }?: {
11
- filePath?: string;
12
- clear?: boolean;
13
- }) => Promise<void>;
14
- export {};