@rsbuild/core 1.3.0-beta.3 → 1.3.0

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.
@@ -2,7 +2,7 @@ async function transformLoader_rslib_entry_transform(source, map) {
2
2
  var _this__compiler___rsbuildTransformer, _this__compiler;
3
3
  let callback = this.async(), bypass = ()=>callback(null, source, map), { id: transformId, getEnvironment } = this.getOptions();
4
4
  if (!transformId) return bypass();
5
- let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
5
+ let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler || null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
6
6
  if (!transform) return bypass();
7
7
  try {
8
8
  let result = await transform({
@@ -13,6 +13,8 @@ async function transformLoader_rslib_entry_transform(source, map) {
13
13
  resourceQuery: this.resourceQuery,
14
14
  environment: getEnvironment(),
15
15
  addDependency: this.addDependency.bind(this),
16
+ addMissingDependency: this.addMissingDependency.bind(this),
17
+ addContextDependency: this.addContextDependency.bind(this),
16
18
  emitFile: this.emitFile.bind(this),
17
19
  importModule: this.importModule.bind(this),
18
20
  resolve: this.resolve.bind(this)
@@ -2,7 +2,7 @@ let transformRawLoader_rslib_entry_ = async function(source, map) {
2
2
  var _this__compiler___rsbuildTransformer, _this__compiler;
3
3
  let callback = this.async(), bypass = ()=>callback(null, source, map), { id: transformId, getEnvironment } = this.getOptions();
4
4
  if (!transformId) return bypass();
5
- let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
5
+ let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler || null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
6
6
  if (!transform) return bypass();
7
7
  try {
8
8
  let result = await transform({
@@ -13,6 +13,8 @@ let transformRawLoader_rslib_entry_ = async function(source, map) {
13
13
  resourceQuery: this.resourceQuery,
14
14
  environment: getEnvironment(),
15
15
  addDependency: this.addDependency.bind(this),
16
+ addMissingDependency: this.addMissingDependency.bind(this),
17
+ addContextDependency: this.addContextDependency.bind(this),
16
18
  emitFile: this.emitFile.bind(this),
17
19
  importModule: this.importModule.bind(this),
18
20
  resolve: this.resolve.bind(this)
@@ -1,4 +1,11 @@
1
1
  import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from './types';
2
+ /**
3
+ * Default allowed origins for CORS.
4
+ * - localhost
5
+ * - 127.0.0.1
6
+ * - [::1]
7
+ */
8
+ export declare const LOCAL_ORIGINS_REGEX: RegExp;
2
9
  export declare function getDefaultEntry(root: string): RsbuildEntry;
3
10
  export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
4
11
  /** #__PURE__
@@ -305,9 +305,9 @@ export interface ServerConfig {
305
305
  };
306
306
  /**
307
307
  * Configure CORS for the dev server or preview server.
308
- * - true: enable CORS with default options.
309
- * - false: disable CORS.
310
308
  * - object: enable CORS with the specified options.
309
+ * - true: enable CORS with default options (allow all origins, not recommended).
310
+ * - false: disable CORS.
311
311
  * @default false
312
312
  * @link https://github.com/expressjs/cors
313
313
  */
@@ -198,6 +198,19 @@ export type TransformContext = {
198
198
  * @param file The absolute path of the module
199
199
  */
200
200
  addDependency: (file: string) => void;
201
+ /**
202
+ * Add a non-existing file as a dependency.
203
+ * Similar to addDependency, but handles the creation of files during compilation before watchers are attached correctly.
204
+ * The file will be watched and changes to the file will trigger rebuild.
205
+ * @param file The absolute path of the module
206
+ */
207
+ addMissingDependency(file: string): void;
208
+ /**
209
+ * Add a directory as dependency.
210
+ * The directory will be watched and changes to the directory will trigger rebuild.
211
+ * @param context The absolute path of the directory
212
+ */
213
+ addContextDependency(context: string): void;
201
214
  /**
202
215
  * Emits a file to the build output.
203
216
  * @param name file name of the asset
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "1.3.0-beta.3",
3
+ "version": "1.3.0",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.dev",
6
6
  "bugs": {
@@ -46,14 +46,14 @@
46
46
  "types.d.ts"
47
47
  ],
48
48
  "dependencies": {
49
- "@rspack/core": "1.3.0-beta.1",
49
+ "@rspack/core": "1.3.0",
50
50
  "@rspack/lite-tapable": "~1.0.1",
51
51
  "@swc/helpers": "^0.5.15",
52
52
  "core-js": "~3.41.0",
53
53
  "jiti": "^2.4.2"
54
54
  },
55
55
  "devDependencies": {
56
- "@rslib/core": "0.5.5",
56
+ "@rslib/core": "0.6.0",
57
57
  "@types/connect": "3.4.38",
58
58
  "@types/cors": "^2.8.17",
59
59
  "@types/node": "^22.13.11",