forked from rollup/rollup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImportDeclaration.ts
37 lines (30 loc) · 1.23 KB
/
ImportDeclaration.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import type MagicString from 'magic-string';
import type { NodeRenderOptions, RenderOptions } from '../../utils/renderHelpers';
import type ImportAttribute from './ImportAttribute';
import type ImportDefaultSpecifier from './ImportDefaultSpecifier';
import type ImportNamespaceSpecifier from './ImportNamespaceSpecifier';
import type ImportSpecifier from './ImportSpecifier';
import type Literal from './Literal';
import type * as NodeType from './NodeType';
import { NodeBase } from './shared/Node';
export default class ImportDeclaration extends NodeBase {
declare attributes: ImportAttribute[];
declare needsBoundaries: true;
declare source: Literal<string>;
declare specifiers: (ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier)[];
declare type: NodeType.tImportDeclaration;
// Do not bind specifiers or attributes
bind(): void {}
hasEffects(): boolean {
return false;
}
initialise(): void {
super.initialise();
this.scope.context.addImport(this);
}
render(code: MagicString, _options: RenderOptions, nodeRenderOptions?: NodeRenderOptions): void {
code.remove(nodeRenderOptions!.start!, nodeRenderOptions!.end!);
}
protected applyDeoptimizations() {}
}
ImportDeclaration.prototype.needsBoundaries = true;