No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
2 | 2 | import Bundle from '../Bundle'; |
|
3 | 3 | import Graph from '../Graph'; |
|
4 | 4 | import { ensureArray } from '../utils/ensureArray'; |
|
5 | - | import { errCannotEmitFromOptionsHook, error } from '../utils/error'; |
|
5 | + | import { errAlreadyClosed, errCannotEmitFromOptionsHook, error } from '../utils/error'; |
|
6 | 6 | import { writeFile } from '../utils/fs'; |
|
7 | 7 | import { normalizeInputOptions } from '../utils/options/normalizeInputOptions'; |
|
8 | 8 | import { normalizeOutputOptions } from '../utils/options/normalizeOutputOptions'; |
56 | 56 | err.watchFiles = watchFiles; |
|
57 | 57 | } |
|
58 | 58 | await graph.pluginDriver.hookParallel('buildEnd', [err]); |
|
59 | + | await graph.pluginDriver.hookParallel('closeBundle', []); |
|
59 | 60 | throw err; |
|
60 | 61 | } |
|
61 | 62 |
65 | 66 | ||
66 | 67 | const result: RollupBuild = { |
|
67 | 68 | cache: useCache ? graph.getCache() : undefined, |
|
69 | + | closed: false, |
|
70 | + | async close() { |
|
71 | + | if (result.closed) return; |
|
72 | + | ||
73 | + | result.closed = true; |
|
74 | + | ||
75 | + | await graph.pluginDriver.hookParallel('closeBundle', []); |
|
76 | + | }, |
|
68 | 77 | async generate(rawOutputOptions: OutputOptions) { |
|
78 | + | if (result.closed) return error(errAlreadyClosed()); |
|
79 | + | ||
69 | 80 | return handleGenerateWrite( |
|
70 | 81 | false, |
|
71 | 82 | inputOptions, |
76 | 87 | }, |
|
77 | 88 | watchFiles: Object.keys(graph.watchFiles), |
|
78 | 89 | async write(rawOutputOptions: OutputOptions) { |
|
90 | + | if (result.closed) return error(errAlreadyClosed()); |
|
91 | + | ||
79 | 92 | return handleGenerateWrite( |
|
80 | 93 | true, |
|
81 | 94 | inputOptions, |
37 | 37 | } |
|
38 | 38 | ||
39 | 39 | export enum Errors { |
|
40 | + | ALREADY_CLOSED = 'ALREADY_CLOSED', |
|
40 | 41 | ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', |
|
41 | 42 | ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', |
|
42 | 43 | ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', |
45 | 46 | CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', |
|
46 | 47 | CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', |
|
47 | 48 | DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', |
|
48 | - | FILE_NOT_FOUND = 'FILE_NOT_FOUND', |
|
49 | + | EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', |
|
49 | 50 | FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', |
|
51 | + | FILE_NOT_FOUND = 'FILE_NOT_FOUND', |
|
50 | 52 | INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', |
|
51 | 53 | INVALID_CHUNK = 'INVALID_CHUNK', |
|
52 | 54 | INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', |
60 | 62 | NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', |
|
61 | 63 | PLUGIN_ERROR = 'PLUGIN_ERROR', |
|
62 | 64 | PREFER_NAMED_EXPORTS = 'PREFER_NAMED_EXPORTS', |
|
65 | + | SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', |
|
63 | 66 | UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', |
|
64 | 67 | UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', |
|
65 | 68 | UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', |
|
66 | - | VALIDATION_ERROR = 'VALIDATION_ERROR', |
|
67 | - | EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', |
|
68 | - | SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT' |
|
69 | + | VALIDATION_ERROR = 'VALIDATION_ERROR' |
|
69 | 70 | } |
|
70 | 71 | ||
71 | 72 | export function errAssetNotFinalisedForFileName(name: string) { |
377 | 378 | }; |
|
378 | 379 | } |
|
379 | 380 | ||
381 | + | export function errAlreadyClosed() { |
|
382 | + | return { |
|
383 | + | code: Errors.ALREADY_CLOSED, |
|
384 | + | message: 'Bundle is already closed, no more calls to "generate" or "write" are allowed.' |
|
385 | + | }; |
|
386 | + | } |
|
387 | + | ||
380 | 388 | export function warnDeprecation( |
|
381 | 389 | deprecation: string | RollupWarning, |
|
382 | 390 | activeDeprecation: boolean, |
Files | Coverage |
---|---|
cli | 0.02% 94.29% |
src | +<.01% 97.34% |
browser/path.ts | 76.92% |
Project Totals (187 files) | 97.08% |
#3883
0805d3b
#3883
4ccb224
#3883
83e205c
#3883
a6050fc
#3883
7d82b73
ca01119
fa22e2e
#3883
df170e7
#3883
4453172
#3883
0d25a8c
#3883
6e7116f
b5f303d
#3883
841fa29
#3883
6525b18
#3883
c142536
593c7c7
#3883
b2b6156
68e13ae
c814344
#3883
bc350f2
74a37fe
92a2dfa