@rspack/core 1.5.0-beta.1 → 1.5.0-rc.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.
@@ -487,7 +487,7 @@ interface Options extends Config {
487
487
  */
488
488
  sourceRoot?: string;
489
489
  plugin?: Plugin;
490
- isModule?: boolean | "unknown";
490
+ isModule?: boolean | "unknown" | "commonjs";
491
491
  /**
492
492
  * Destination path. Note that this value is used only to fix source path
493
493
  * of source map files and swc does not write output to this path.
@@ -731,7 +731,7 @@ interface EsParserConfig {
731
731
  */
732
732
  importAssertions?: boolean;
733
733
  /**
734
- * Defaults to `false`
734
+ * @deprecated Always true in swc
735
735
  */
736
736
  importAttributes?: boolean;
737
737
  /**
@@ -785,6 +785,7 @@ interface TransformConfig {
785
785
  * https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax
786
786
  */
787
787
  verbatimModuleSyntax?: boolean;
788
+ tsEnumIsMutable?: boolean;
788
789
  }
789
790
  interface ReactConfig {
790
791
  /**
@@ -1 +1 @@
1
- {"name":"@swc/types","author":"강동윤 <kdy1997.dev@gmail.com>","version":"0.1.23","license":"Apache-2.0","types":"index.d.ts","type":"commonjs"}
1
+ {"name":"@swc/types","author":"강동윤 <kdy1997.dev@gmail.com>","version":"0.1.24","license":"Apache-2.0","types":"index.d.ts","type":"commonjs"}
@@ -16,4 +16,8 @@ export default class NativeWatchFileSystem implements WatchFileSystem {
16
16
  }, _startTime: number, options: Watchpack.WatchOptions, callback: (error: Error | null, fileTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, contextTimeInfoEntries: Map<string, FileSystemInfoEntry | "ignore">, changedFiles: Set<string>, removedFiles: Set<string>) => void, callbackUndelayed: (fileName: string, changeTime: number) => void): Watcher;
17
17
  getNativeWatcher(options: Watchpack.WatchOptions): binding.NativeWatcher;
18
18
  triggerEvent(kind: "change" | "remove" | "create", path: string): void;
19
+ formatWatchDependencies(dependencies: Iterable<string> & {
20
+ added?: Iterable<string>;
21
+ removed?: Iterable<string>;
22
+ }): [string[], string[]];
19
23
  }
package/dist/index.js CHANGED
@@ -228,9 +228,6 @@ var __webpack_modules__ = {
228
228
  "node:https": function(module) {
229
229
  module.exports = require("node:https");
230
230
  },
231
- "node:inspector": function(module) {
232
- module.exports = require("node:inspector");
233
- },
234
231
  "node:os": function(module) {
235
232
  module.exports = require("node:os");
236
233
  },
@@ -250,6 +247,11 @@ var __webpack_modules__ = {
250
247
  module.exports = import("../compiled/tinypool/dist/index.js").then(function(module) {
251
248
  return module;
252
249
  });
250
+ },
251
+ "node:inspector": function(module) {
252
+ module.exports = import("node:inspector").then(function(module) {
253
+ return module;
254
+ });
253
255
  }
254
256
  }, __webpack_module_cache__ = {};
255
257
  function __webpack_require__(moduleId) {
@@ -2598,7 +2600,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
2598
2600
  static session;
2599
2601
  static counter = 10000;
2600
2602
  static async initJavaScriptTrace(layer, output) {
2601
- let { Session } = __webpack_require__("node:inspector");
2603
+ let { Session } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "node:inspector"));
2602
2604
  this.session = new Session(), this.layer = layer, this.output = output, this.events = [], this.state = "on", this.startTime = process.hrtime.bigint();
2603
2605
  }
2604
2606
  static uuid() {
@@ -4118,7 +4120,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4118
4120
  let HttpExternalsRspackPlugin = base_create(binding_.BuiltinPluginName.HttpExternalsRspackPlugin, (css, webAsync)=>({
4119
4121
  css,
4120
4122
  webAsync
4121
- })), getHttp = memoize(()=>__webpack_require__("node:http")), getHttps = memoize(()=>__webpack_require__("node:https")), defaultHttpClient = async (url, headers)=>{
4123
+ })), getHttp = memoize(()=>__webpack_require__("node:http")), getHttps = memoize(()=>__webpack_require__("node:https")), defaultHttpClientForNode = async (url, headers)=>{
4122
4124
  let { res, body } = await function(url, options) {
4123
4125
  let send = "https:" === new URL(url).protocol ? getHttps() : getHttp(), { createBrotliDecompress, createGunzip, createInflate } = __webpack_require__("node:zlib");
4124
4126
  return new Promise((resolve, reject)=>{
@@ -4161,7 +4163,7 @@ Plugins which provide custom chunk loading types must call EnableChunkLoadingPlu
4161
4163
  lockfileLocation,
4162
4164
  cacheLocation,
4163
4165
  upgrade: options.upgrade ?? !1,
4164
- httpClient: options.httpClient ?? defaultHttpClient
4166
+ httpClient: options.httpClient ?? defaultHttpClientForNode
4165
4167
  };
4166
4168
  return createBuiltinPlugin(this.name, raw);
4167
4169
  }
@@ -8627,7 +8629,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
8627
8629
  }, applyExperimentsDefaults = (experiments, { production, development })=>{
8628
8630
  defaults_F(experiments, "cache", ()=>development), D(experiments, "futureDefaults", !1), D(experiments, "lazyCompilation", !1), D(experiments, "asyncWebAssembly", experiments.futureDefaults), D(experiments, "css", !!experiments.futureDefaults || void 0), D(experiments, "layers", !1), !1 === experiments.topLevelAwait && console.warn("`experiments.topLevelAwait` config has been deprecated and will be removed in Rspack v2.0. Top-level await will be always enabled. Please remove this option from your Rspack configuration."), D(experiments, "topLevelAwait", !0), D(experiments, "buildHttp", void 0), experiments.buildHttp && "object" == typeof experiments.buildHttp && D(experiments.buildHttp, "upgrade", !1), D(experiments, "incremental", {}), "object" == typeof experiments.incremental && (D(experiments.incremental, "silent", !0), D(experiments.incremental, "make", !0), D(experiments.incremental, "inferAsyncModules", !0), D(experiments.incremental, "providedExports", !0), D(experiments.incremental, "dependenciesDiagnostics", !0), D(experiments.incremental, "sideEffects", !0), D(experiments.incremental, "buildChunkGraph", !0), D(experiments.incremental, "moduleIds", !0), D(experiments.incremental, "chunkIds", !0), D(experiments.incremental, "modulesHashes", !0), D(experiments.incremental, "modulesCodegen", !0), D(experiments.incremental, "modulesRuntimeRequirements", !0), D(experiments.incremental, "chunksRuntimeRequirements", !0), D(experiments.incremental, "chunksHashes", !0), D(experiments.incremental, "chunksRender", !0), D(experiments.incremental, "emitAssets", !0)), D(experiments, "rspackFuture", {}), D(experiments, "parallelCodeSplitting", !1), D(experiments, "parallelLoader", !1), D(experiments, "useInputFileSystem", !1), D(experiments, "inlineConst", !1), D(experiments, "inlineEnum", !1), D(experiments, "typeReexportsPresence", !1), D(experiments, "lazyBarrel", !1);
8629
8631
  }, applybundlerInfoDefaults = (rspackFuture, library)=>{
8630
- "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.5.0-beta.1"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
8632
+ "object" == typeof rspackFuture && (D(rspackFuture, "bundlerInfo", {}), "object" == typeof rspackFuture.bundlerInfo && (D(rspackFuture.bundlerInfo, "version", "1.5.0-rc.0"), D(rspackFuture.bundlerInfo, "bundler", "rspack"), D(rspackFuture.bundlerInfo, "force", !library)));
8631
8633
  }, applySnapshotDefaults = (_snapshot, _env)=>{}, applyModuleDefaults = (module, { asyncWebAssembly, css, targetProperties, mode, uniqueName, inlineConst })=>{
8632
8634
  if (assertNotNill(module.parser), assertNotNill(module.generator), defaults_F(module.parser, "asset", ()=>({})), assertNotNill(module.parser.asset), defaults_F(module.parser.asset, "dataUrlCondition", ()=>({})), "object" == typeof module.parser.asset.dataUrlCondition && D(module.parser.asset.dataUrlCondition, "maxSize", 8096), defaults_F(module.parser, "javascript", ()=>({})), assertNotNill(module.parser.javascript), ((parserOptions, { inlineConst })=>{
8633
8635
  D(parserOptions, "dynamicImportMode", "lazy"), D(parserOptions, "dynamicImportPrefetch", !1), D(parserOptions, "dynamicImportPreload", !1), D(parserOptions, "url", !0), D(parserOptions, "exprContextCritical", !0), D(parserOptions, "unknownContextCritical", !0), D(parserOptions, "wrappedContextCritical", !1), D(parserOptions, "wrappedContextRegExp", /.*/), D(parserOptions, "strictExportPresence", !1), D(parserOptions, "requireAsExpression", !0), D(parserOptions, "requireDynamic", !0), D(parserOptions, "requireResolve", !0), D(parserOptions, "importDynamic", !0), D(parserOptions, "worker", [
@@ -10270,7 +10272,7 @@ You can also more options via the 'target' option: 'browserslist' / 'browserslis
10270
10272
  });
10271
10273
  }
10272
10274
  }
10273
- let CORE_VERSION = "1.5.0-beta.1", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
10275
+ let CORE_VERSION = "1.5.0-rc.0", bindingVersionCheck_errorMessage = (coreVersion, expectedCoreVersion)=>process.env.RSPACK_BINDING ? `Unmatched version @rspack/core@${coreVersion} and binding version.
10274
10276
 
10275
10277
  Help:
10276
10278
  Looks like you are using a custom binding (via environment variable 'RSPACK_BINDING=${process.env.RSPACK_BINDING}').
@@ -10283,6 +10285,7 @@ Help:
10283
10285
  `;
10284
10286
  class NativeWatchFileSystem {
10285
10287
  #inner;
10288
+ #isFirstWatch = !0;
10286
10289
  #inputFileSystem;
10287
10290
  constructor(inputFileSystem){
10288
10291
  this.#inputFileSystem = inputFileSystem;
@@ -10294,16 +10297,7 @@ Help:
10294
10297
  if ("object" != typeof options) throw Error("Invalid arguments: 'options'");
10295
10298
  if ("function" != typeof callbackUndelayed && callbackUndelayed) throw Error("Invalid arguments: 'callbackUndelayed'");
10296
10299
  let nativeWatcher = this.getNativeWatcher(options);
10297
- return nativeWatcher.watch([
10298
- Array.from(files.added),
10299
- Array.from(files.removed)
10300
- ], [
10301
- Array.from(directories.added),
10302
- Array.from(directories.removed)
10303
- ], [
10304
- Array.from(missing.added),
10305
- Array.from(missing.removed)
10306
- ], (err, result)=>{
10300
+ return nativeWatcher.watch(this.formatWatchDependencies(files), this.formatWatchDependencies(directories), this.formatWatchDependencies(missing), (err, result)=>{
10307
10301
  if (err) return void callback(err, new Map(), new Map(), new Set(), new Set());
10308
10302
  nativeWatcher.pause();
10309
10303
  let changedFiles = result.changedFiles, removedFiles = result.removedFiles;
@@ -10315,7 +10309,7 @@ Help:
10315
10309
  callback(err, new Map(), new Map(), new Set(changedFiles), new Set(removedFiles));
10316
10310
  }, (fileName)=>{
10317
10311
  callbackUndelayed(fileName, Date.now());
10318
- }), {
10312
+ }), this.#isFirstWatch = !1, {
10319
10313
  close: ()=>{
10320
10314
  nativeWatcher.close().then(()=>{
10321
10315
  this.#inner = void 0;
@@ -10350,6 +10344,15 @@ Help:
10350
10344
  triggerEvent(kind, path) {
10351
10345
  this.#inner?.triggerEvent(kind, path);
10352
10346
  }
10347
+ formatWatchDependencies(dependencies) {
10348
+ return this.#isFirstWatch ? [
10349
+ Array.from(dependencies),
10350
+ []
10351
+ ] : [
10352
+ Array.from(dependencies.added ?? []),
10353
+ Array.from(dependencies.removed ?? [])
10354
+ ];
10355
+ }
10353
10356
  }
10354
10357
  let VFILES_BY_COMPILER = new WeakMap();
10355
10358
  class VirtualModulesPlugin {
@@ -11550,7 +11553,7 @@ Help:
11550
11553
  obj.children = this.stats.map((stat, idx)=>{
11551
11554
  let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name;
11552
11555
  return obj.name = compilationName && makePathsRelative(childOptions.context, compilationName, stat.compilation.compiler.root), obj;
11553
- }), childOptions.version && (obj.rspackVersion = "1.5.0-beta.1", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
11556
+ }), childOptions.version && (obj.rspackVersion = "1.5.0-rc.0", obj.version = "5.75.0"), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
11554
11557
  let mapError = (j, obj)=>({
11555
11558
  ...obj,
11556
11559
  compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
@@ -12450,7 +12453,7 @@ Help:
12450
12453
  object.hash = context.getStatsCompilation(compilation).hash;
12451
12454
  },
12452
12455
  version: (object)=>{
12453
- object.version = "5.75.0", object.rspackVersion = "1.5.0-beta.1";
12456
+ object.version = "5.75.0", object.rspackVersion = "1.5.0-rc.0";
12454
12457
  },
12455
12458
  env: (object, _compilation, _context, { _env })=>{
12456
12459
  object.env = _env;
@@ -15763,7 +15766,7 @@ Help:
15763
15766
  let _options = JSON.stringify(options || {});
15764
15767
  return binding_default().transform(source, _options);
15765
15768
  }
15766
- let exports_rspackVersion = "1.5.0-beta.1", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
15769
+ let exports_rspackVersion = "1.5.0-rc.0", exports_version = "5.75.0", exports_WebpackError = Error, sources = __webpack_require__("webpack-sources"), exports_config = {
15767
15770
  getNormalizedRspackOptions: getNormalizedRspackOptions,
15768
15771
  applyRspackOptionsDefaults: applyRspackOptionsDefaults,
15769
15772
  getNormalizedWebpackOptions: getNormalizedRspackOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.5.0-beta.1",
3
+ "version": "1.5.0-rc.0",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -40,7 +40,7 @@
40
40
  "@ast-grep/napi": "^0.39.1",
41
41
  "@rsbuild/plugin-node-polyfill": "^1.4.1",
42
42
  "@rslib/core": "0.12.1",
43
- "@swc/types": "0.1.23",
43
+ "@swc/types": "0.1.24",
44
44
  "@types/graceful-fs": "4.1.9",
45
45
  "@types/watchpack": "^2.4.4",
46
46
  "browserslist-load-config": "^1.0.0",
@@ -60,7 +60,7 @@
60
60
  "dependencies": {
61
61
  "@module-federation/runtime-tools": "0.18.0",
62
62
  "@rspack/lite-tapable": "1.0.1",
63
- "@rspack/binding": "1.5.0-beta.1"
63
+ "@rspack/binding": "1.5.0-rc.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@swc/helpers": ">=0.5.1"