@rspack/browser 1.7.0 → 1.7.2

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.
@@ -7,7 +7,7 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation, JsRuntimeModule } from '@rspack/binding';
10
+ import type { AssetInfo, ChunkGroup, Dependency, ExternalObject, JsCompilation } from '@rspack/binding';
11
11
  import binding from '@rspack/binding';
12
12
  export type { AssetInfo } from '@rspack/binding';
13
13
  import * as liteTapable from '@rspack/lite-tapable';
@@ -185,7 +185,7 @@ export declare class Compilation {
185
185
  Set<string>
186
186
  ]>;
187
187
  runtimeRequirementInTree: liteTapable.HookMap<liteTapable.SyncBailHook<[Chunk, Set<string>], void>>;
188
- runtimeModule: liteTapable.SyncHook<[JsRuntimeModule, Chunk]>;
188
+ runtimeModule: liteTapable.SyncHook<[RuntimeModule, Chunk]>;
189
189
  seal: liteTapable.SyncHook<[]>;
190
190
  afterSeal: liteTapable.AsyncSeriesHook<[], void>;
191
191
  needAdditionalPass: liteTapable.SyncBailHook<[], boolean>;
@@ -18,7 +18,7 @@ import { ContextModuleFactory } from './ContextModuleFactory';
18
18
  import type { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from './config';
19
19
  import type { PlatformTargetProperties } from './config/target';
20
20
  import type { FileSystemInfoEntry } from './FileSystemInfo';
21
- import { rspack } from './index';
21
+ import type { rspack } from './index';
22
22
  import Cache from './lib/Cache';
23
23
  import CacheFacade from './lib/CacheFacade';
24
24
  import { Logger } from './logging/Logger';
@@ -1,4 +1,4 @@
1
- import type { JsAddingRuntimeModule } from '@rspack/binding';
1
+ import type { JsAddingRuntimeModule, JsRuntimeModule, JsSource } from '@rspack/binding';
2
2
  import type { Chunk } from './Chunk';
3
3
  import type { ChunkGraph } from './ChunkGraph';
4
4
  import type { Compilation } from './Compilation';
@@ -23,6 +23,7 @@ export declare class RuntimeModule {
23
23
  protected chunkGraph: ChunkGraph | null;
24
24
  constructor(name: string, stage?: RuntimeModuleStage);
25
25
  attach(compilation: Compilation, chunk: Chunk, chunkGraph: ChunkGraph): void;
26
+ get source(): JsSource | undefined;
26
27
  get name(): string;
27
28
  get stage(): RuntimeModuleStage;
28
29
  identifier(): string;
@@ -30,3 +31,4 @@ export declare class RuntimeModule {
30
31
  shouldIsolate(): boolean;
31
32
  generate(): string;
32
33
  }
34
+ export declare function createRenderedRuntimeModule(module: JsRuntimeModule): RuntimeModule;
@@ -22,4 +22,4 @@ export declare enum RequestType {
22
22
  CompilationGetAssetPath = "CompilationGetAssetPath",
23
23
  CompilationGetAssetPathWithInfo = "CompilationGetAssetPathWithInfo"
24
24
  }
25
- export declare function run(): Promise<void>;
25
+ export declare function run(): Promise<never>;
@@ -38,6 +38,8 @@ export type ApiTargetProperties = {
38
38
  importScripts: boolean | null;
39
39
  /** has importScripts available when creating a worker */
40
40
  importScriptsInWorker: boolean | null;
41
+ /** node.js allows to use `import.meta.dirname` and `import.meta.filename` */
42
+ importMetaDirnameAndFilename: boolean | null;
41
43
  /** has fetch function available for WebAssembly */
42
44
  fetchWasm: boolean | null;
43
45
  /** has global variable available */
@@ -272,6 +272,8 @@ export type Environment = {
272
272
  dynamicImport?: boolean;
273
273
  /** The environment supports an async import() when creating a worker, only for web targets at the moment. */
274
274
  dynamicImportInWorker?: boolean;
275
+ /** The environment supports `import.meta.dirname` and `import.meta.filename`. */
276
+ importMetaDirnameAndFilename?: boolean;
275
277
  /** The environment supports 'for of' iteration ('for (const x of array) { ... }'). */
276
278
  forOf?: boolean;
277
279
  /** The environment supports 'globalThis'. */
@@ -851,6 +853,11 @@ export type JavascriptParserOptions = {
851
853
  worker?: string[] | boolean;
852
854
  /** Override the module to strict or non-strict. */
853
855
  overrideStrict?: 'strict' | 'non-strict';
856
+ /**
857
+ * Control whether renaming of the CommonJS `require` function will be parsed and transformed.
858
+ * @default true
859
+ */
860
+ requireAlias?: boolean;
854
861
  requireAsExpression?: boolean;
855
862
  requireDynamic?: boolean;
856
863
  requireResolve?: boolean;