@rollup/browser 4.56.0 → 4.57.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.
@@ -261,6 +261,7 @@ export interface PluginContext extends MinimalPluginContext {
261
261
  source: string,
262
262
  importer?: string,
263
263
  options?: {
264
+ importerAttributes?: Record<string, string>;
264
265
  attributes?: Record<string, string>;
265
266
  custom?: CustomPluginOptions;
266
267
  isEntry?: boolean;
@@ -312,13 +313,19 @@ export type ResolveIdHook = (
312
313
  this: PluginContext,
313
314
  source: string,
314
315
  importer: string | undefined,
315
- options: { attributes: Record<string, string>; custom?: CustomPluginOptions; isEntry: boolean }
316
+ options: {
317
+ attributes: Record<string, string>;
318
+ custom?: CustomPluginOptions;
319
+ importerAttributes?: Record<string, string> | undefined;
320
+ isEntry: boolean;
321
+ }
316
322
  ) => ResolveIdResult;
317
323
 
318
324
  export type ShouldTransformCachedModuleHook = (
319
325
  this: PluginContext,
320
326
  options: {
321
327
  ast: ProgramNode;
328
+ attributes: Record<string, string>;
322
329
  code: string;
323
330
  id: string;
324
331
  meta: CustomPluginOptions;
@@ -338,7 +345,19 @@ export type HasModuleSideEffects = (id: string, external: boolean) => boolean;
338
345
 
339
346
  export type LoadResult = SourceDescription | string | NullValue;
340
347
 
341
- export type LoadHook = (this: PluginContext, id: string) => LoadResult;
348
+ export type LoadHook = (
349
+ this: PluginContext,
350
+ id: string,
351
+ // temporarily marked as optional for better Vite type-compatibility
352
+ options?:
353
+ | {
354
+ // unused, temporarily added for better Vite type-compatibility
355
+ ssr?: boolean | undefined;
356
+ // temporarily marked as optional for better Vite type-compatibility
357
+ attributes?: Record<string, string>;
358
+ }
359
+ | undefined
360
+ ) => LoadResult;
342
361
 
343
362
  export interface TransformPluginContext extends PluginContext {
344
363
  debug: LoggingFunctionWithPosition;
@@ -353,7 +372,16 @@ export type TransformResult = string | NullValue | Partial<SourceDescription>;
353
372
  export type TransformHook = (
354
373
  this: TransformPluginContext,
355
374
  code: string,
356
- id: string
375
+ id: string,
376
+ // temporarily marked as optional for better Vite type-compatibility
377
+ options?:
378
+ | {
379
+ // unused, temporarily added for better Vite type-compatibility
380
+ ssr?: boolean | undefined;
381
+ // temporarily marked as optional for better Vite type-compatibility
382
+ attributes?: Record<string, string>;
383
+ }
384
+ | undefined
357
385
  ) => TransformResult;
358
386
 
359
387
  export type ModuleParsedHook = (this: PluginContext, info: ModuleInfo) => void;
@@ -370,18 +398,24 @@ export type ResolveDynamicImportHook = (
370
398
  this: PluginContext,
371
399
  specifier: string | AstNode,
372
400
  importer: string,
373
- options: { attributes: Record<string, string> }
401
+ options: { attributes: Record<string, string>; importerAttributes: Record<string, string> }
374
402
  ) => ResolveIdResult;
375
403
 
376
404
  export type ResolveImportMetaHook = (
377
405
  this: PluginContext,
378
406
  property: string | null,
379
- options: { chunkId: string; format: InternalModuleFormat; moduleId: string }
407
+ options: {
408
+ attributes: Record<string, string>;
409
+ chunkId: string;
410
+ format: InternalModuleFormat;
411
+ moduleId: string;
412
+ }
380
413
  ) => string | NullValue;
381
414
 
382
415
  export type ResolveFileUrlHook = (
383
416
  this: PluginContext,
384
417
  options: {
418
+ attributes: Record<string, string>;
385
419
  chunkId: string;
386
420
  fileName: string;
387
421
  format: InternalModuleFormat;
@@ -463,6 +497,7 @@ export interface FunctionPluginHooks {
463
497
  chunk: PreRenderedChunkWithFileName;
464
498
  targetChunk: PreRenderedChunkWithFileName | null;
465
499
  getTargetChunkImports: () => DynamicImportTargetChunk[] | null;
500
+ targetModuleAttributes: Record<string, string>;
466
501
  }
467
502
  ) => { left: string; right: string } | NullValue;
468
503
  renderError: (this: PluginContext, error?: Error) => void;