rollup 4.1.6 → 4.2.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.
package/dist/bin/rollup CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  /*
3
3
  @license
4
- Rollup.js v4.1.6
5
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
4
+ Rollup.js v4.2.0
5
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
6
6
 
7
7
  https://github.com/rollup/rollup
8
8
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,12 +1,12 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
10
  import '../native.js';
11
- export { parseAst } from './shared/parseAst.js';
11
+ export { parseAst, parseAstAsync } from './shared/parseAst.js';
12
12
  import 'node:path';
package/dist/es/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
- import { normalize, getImportPath, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, logInvalidAnnotation, logModuleLevelDirective, logIllegalImportReassignment, logMissingExport, logCannotCallNamespace, logEval, LOGLEVEL_INFO, logFirstSideEffect, locate, logThisIsUndefined, logImportAttributeIsInvalid, logImportOptionsAreInvalid, error, logSyntheticNamedExportsNeedNamespaceExport, logInvalidFormatForTopLevelAwait, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logModuleParseError, logCircularReexport, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logAddonNotGenerated, logIncompatibleExportOptionValue, logMixedExport, logFailedValidation, isPathFragment, logCyclicCrossChunkReexport, getAliasName, logUnexpectedNamedImport, isAbsolute as isAbsolute$1, relative as relative$1, logUnexpectedNamespaceReexport, logEmptyChunk, logMissingGlobalName, logOptimizeChunkStatus, logSourcemapBroken, logConflictingSourcemapSources, logChunkInvalid, logInvalidOption, URL_OUTPUT_FORMAT, URL_OUTPUT_DIR, URL_OUTPUT_SOURCEMAPFILE, URL_OUTPUT_AMD_ID, logCannotAssignModuleToChunk, logAnonymousPluginCache, logDuplicatePluginName, LOGLEVEL_ERROR, logLevelPriority, relativeId, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInvalidRollupPhaseForAddWatchFile, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
10
+ import { normalize, getImportPath, LOGLEVEL_WARN, logUnusedExternalImports, ANNOTATION_KEY, INVALID_ANNOTATION_KEY, logInvalidAnnotation, logModuleLevelDirective, logIllegalImportReassignment, logMissingExport, logCannotCallNamespace, logEval, LOGLEVEL_INFO, logFirstSideEffect, locate, logThisIsUndefined, logImportAttributeIsInvalid, logImportOptionsAreInvalid, error, logSyntheticNamedExportsNeedNamespaceExport, logInvalidFormatForTopLevelAwait, logInvalidSourcemapForError, augmentCodeLocation, logInconsistentImportAttributes, logNamespaceConflict, logAmbiguousExternalNamespaces, logShimmedExport, parseAst, logModuleParseError, parseAstAsync, logCircularReexport, logMissingNodeBuiltins, logIllegalIdentifierAsName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logAddonNotGenerated, logIncompatibleExportOptionValue, logMixedExport, logFailedValidation, isPathFragment, logCyclicCrossChunkReexport, getAliasName, logUnexpectedNamedImport, isAbsolute as isAbsolute$1, relative as relative$1, logUnexpectedNamespaceReexport, logEmptyChunk, logMissingGlobalName, logOptimizeChunkStatus, logSourcemapBroken, logConflictingSourcemapSources, logChunkInvalid, logInvalidOption, URL_OUTPUT_FORMAT, URL_OUTPUT_DIR, URL_OUTPUT_SOURCEMAPFILE, URL_OUTPUT_AMD_ID, logCannotAssignModuleToChunk, logAnonymousPluginCache, logDuplicatePluginName, LOGLEVEL_ERROR, logLevelPriority, relativeId, LOGLEVEL_DEBUG, logUnknownOption, printQuotedStringList, logInvalidSetAssetSourceCall, logPluginError, logNoTransformMapOrAstWithoutCode, logBadLoader, logExternalModulesCannotBeTransformedToModules, logInternalIdCannotBeExternal, isRelative, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logExternalSyntheticExports, logUnresolvedEntry, logUnresolvedImplicitDependant, logExternalModulesCannotBeIncludedInManualChunks, logEntryCannotBeExternal, logImplicitDependantCannotBeExternal, logNoAssetSourceSet, logFileReferenceIdNotFoundForFilename, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logInvalidRollupPhaseForChunkEmission, logFileNameConflict, logAssetNotFinalisedForFileName, logChunkNotGeneratedForFileName, logInvalidLogPosition, logInvalidRollupPhaseForAddWatchFile, logInputHookInOutputPlugin, logInvalidFunctionPluginHook, logInvalidAddonPluginHook, logImplicitDependantIsNotIncluded, logCircularDependency, URL_TREESHAKE_MODULESIDEEFFECTS, URL_TREESHAKE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_PRESERVEENTRYSIGNATURES, URL_OUTPUT_AMD_BASEPATH, logInvalidExportOptionValue, warnDeprecation, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, isValidUrl, addTrailingSlashIfMissed, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, logAlreadyClosed, logMissingFileOrDirOption, logCannotEmitFromOptionsHook, URL_WATCH } from './parseAst.js';
11
11
  import { relative, dirname, basename, extname, resolve as resolve$1 } from 'node:path';
12
12
  import require$$0$1, { win32, posix, isAbsolute, resolve } from 'path';
13
13
  import process$1, { env as env$1 } from 'node:process';
@@ -16,7 +16,7 @@ import { xxhashBase64Url } from '../../native.js';
16
16
  import { lstat, realpath, readdir, readFile, mkdir, writeFile } from 'node:fs/promises';
17
17
  import * as tty from 'tty';
18
18
 
19
- var version = "4.1.6";
19
+ var version = "4.2.0";
20
20
 
21
21
  const comma = ','.charCodeAt(0);
22
22
  const semicolon = ';'.charCodeAt(0);
@@ -12925,7 +12925,7 @@ class Module {
12925
12925
  }
12926
12926
  return { source, usesTopLevelAwait };
12927
12927
  }
12928
- setSource({ ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, ...moduleOptions }) {
12928
+ async setSource({ ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, ...moduleOptions }) {
12929
12929
  if (code.startsWith('#!')) {
12930
12930
  const shebangEndPosition = code.indexOf('\n');
12931
12931
  this.shebang = code.slice(2, shebangEndPosition);
@@ -12950,7 +12950,7 @@ class Module {
12950
12950
  this.transformDependencies = transformDependencies;
12951
12951
  this.customTransformCache = customTransformCache;
12952
12952
  this.updateOptions(moduleOptions);
12953
- const moduleAst = ast ?? this.tryParse();
12953
+ const moduleAst = ast ?? (await this.tryParseAsync());
12954
12954
  timeEnd('generate ast', 3);
12955
12955
  timeStart('analyze ast', 3);
12956
12956
  this.resolvedIds = resolvedIds ?? Object.create(null);
@@ -13352,6 +13352,14 @@ class Module {
13352
13352
  return this.error(logModuleParseError(error_, this.id), error_.pos);
13353
13353
  }
13354
13354
  }
13355
+ async tryParseAsync() {
13356
+ try {
13357
+ return (await parseAstAsync(this.info.code));
13358
+ }
13359
+ catch (error_) {
13360
+ return this.error(logModuleParseError(error_, this.id), error_.pos);
13361
+ }
13362
+ }
13355
13363
  }
13356
13364
  // if there is a cyclic import in the reexport chain, we should not
13357
13365
  // import from the original module but from the cyclic module to not
@@ -17565,11 +17573,11 @@ class ModuleLoader {
17565
17573
  for (const emittedFile of cachedModule.transformFiles)
17566
17574
  this.pluginDriver.emitFile(emittedFile);
17567
17575
  }
17568
- module.setSource(cachedModule);
17576
+ await module.setSource(cachedModule);
17569
17577
  }
17570
17578
  else {
17571
17579
  module.updateOptions(sourceDescription);
17572
- module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onLog));
17580
+ await module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onLog));
17573
17581
  }
17574
17582
  }
17575
17583
  async awaitLoadModulesPromise() {
@@ -1,13 +1,13 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
8
8
  Released under the MIT License.
9
9
  */
10
- import { parse } from '../../native.js';
10
+ import { parse, parseAsync } from '../../native.js';
11
11
  import { resolve, basename, extname, dirname } from 'node:path';
12
12
 
13
13
  const FIXED_STRINGS = [
@@ -777,7 +777,8 @@ function logModuleParseError(error, moduleId) {
777
777
  cause: error,
778
778
  code: PARSE_ERROR,
779
779
  id: moduleId,
780
- message
780
+ message,
781
+ stack: error.stack
781
782
  };
782
783
  }
783
784
  function logPluginError(error, plugin, { hook, id } = {}) {
@@ -2128,7 +2129,14 @@ function getReadStringFunction(astBuffer) {
2128
2129
  const parseAst = (input, { allowReturnOutsideFunction = false } = {}) => {
2129
2130
  const astBuffer = parse(input, allowReturnOutsideFunction);
2130
2131
  const readString = getReadStringFunction(astBuffer);
2131
- return convertProgram(astBuffer.buffer, readString);
2132
+ const result = convertProgram(astBuffer.buffer, readString);
2133
+ return result;
2134
+ };
2135
+ const parseAstAsync = async (input, { allowReturnOutsideFunction = false, signal } = {}) => {
2136
+ const astBuffer = await parseAsync(input, allowReturnOutsideFunction, signal);
2137
+ const readString = getReadStringFunction(astBuffer);
2138
+ const result = convertProgram(astBuffer.buffer, readString);
2139
+ return result;
2132
2140
  };
2133
2141
 
2134
- export { ANNOTATION_KEY, INVALID_ANNOTATION_KEY, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_INFO, LOGLEVEL_WARN, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_AMD_ID, URL_OUTPUT_DIR, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, URL_OUTPUT_FORMAT, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_SOURCEMAPFILE, URL_PRESERVEENTRYSIGNATURES, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, URL_WATCH, addTrailingSlashIfMissed, augmentCodeLocation, error, getAliasName, getImportPath, isAbsolute, isPathFragment, isRelative, isValidUrl, locate, logAddonNotGenerated, logAlreadyClosed, logAmbiguousExternalNamespaces, logAnonymousPluginCache, logAssetNotFinalisedForFileName, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logBadLoader, logCannotAssignModuleToChunk, logCannotCallNamespace, logCannotEmitFromOptionsHook, logChunkInvalid, logChunkNotGeneratedForFileName, logCircularDependency, logCircularReexport, logConflictingSourcemapSources, logCyclicCrossChunkReexport, logDuplicatePluginName, logEmptyChunk, logEntryCannotBeExternal, logEval, logExternalModulesCannotBeIncludedInManualChunks, logExternalModulesCannotBeTransformedToModules, logExternalSyntheticExports, logFailedValidation, logFileNameConflict, logFileReferenceIdNotFoundForFilename, logFirstSideEffect, logIllegalIdentifierAsName, logIllegalImportReassignment, logImplicitDependantCannotBeExternal, logImplicitDependantIsNotIncluded, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logIncompatibleExportOptionValue, logInconsistentImportAttributes, logInputHookInOutputPlugin, logInternalIdCannotBeExternal, logInvalidAddonPluginHook, logInvalidAnnotation, logInvalidExportOptionValue, logInvalidFormatForTopLevelAwait, logInvalidFunctionPluginHook, logInvalidLogPosition, logInvalidOption, logInvalidRollupPhaseForAddWatchFile, logInvalidRollupPhaseForChunkEmission, logInvalidSetAssetSourceCall, logInvalidSourcemapForError, logLevelPriority, logMissingExport, logMissingFileOrDirOption, logMissingGlobalName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logMissingNodeBuiltins, logMixedExport, logModuleLevelDirective, logModuleParseError, logNamespaceConflict, logNoAssetSourceSet, logNoTransformMapOrAstWithoutCode, logOptimizeChunkStatus, logPluginError, logShimmedExport, logSourcemapBroken, logSyntheticNamedExportsNeedNamespaceExport, logThisIsUndefined, logUnexpectedNamedImport, logUnexpectedNamespaceReexport, logUnknownOption, logUnresolvedEntry, logUnresolvedImplicitDependant, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logUnusedExternalImports, normalize, parseAst, printQuotedStringList, relative, relativeId, warnDeprecation };
2142
+ export { ANNOTATION_KEY, INVALID_ANNOTATION_KEY, LOGLEVEL_DEBUG, LOGLEVEL_ERROR, LOGLEVEL_INFO, LOGLEVEL_WARN, URL_OUTPUT_AMD_BASEPATH, URL_OUTPUT_AMD_ID, URL_OUTPUT_DIR, URL_OUTPUT_EXTERNALIMPORTATTRIBUTES, URL_OUTPUT_FORMAT, URL_OUTPUT_GENERATEDCODE, URL_OUTPUT_INLINEDYNAMICIMPORTS, URL_OUTPUT_INTEROP, URL_OUTPUT_MANUALCHUNKS, URL_OUTPUT_SOURCEMAPBASEURL, URL_OUTPUT_SOURCEMAPFILE, URL_PRESERVEENTRYSIGNATURES, URL_TREESHAKE, URL_TREESHAKE_MODULESIDEEFFECTS, URL_WATCH, addTrailingSlashIfMissed, augmentCodeLocation, error, getAliasName, getImportPath, isAbsolute, isPathFragment, isRelative, isValidUrl, locate, logAddonNotGenerated, logAlreadyClosed, logAmbiguousExternalNamespaces, logAnonymousPluginCache, logAssetNotFinalisedForFileName, logAssetReferenceIdNotFoundForSetSource, logAssetSourceAlreadySet, logBadLoader, logCannotAssignModuleToChunk, logCannotCallNamespace, logCannotEmitFromOptionsHook, logChunkInvalid, logChunkNotGeneratedForFileName, logCircularDependency, logCircularReexport, logConflictingSourcemapSources, logCyclicCrossChunkReexport, logDuplicatePluginName, logEmptyChunk, logEntryCannotBeExternal, logEval, logExternalModulesCannotBeIncludedInManualChunks, logExternalModulesCannotBeTransformedToModules, logExternalSyntheticExports, logFailedValidation, logFileNameConflict, logFileReferenceIdNotFoundForFilename, logFirstSideEffect, logIllegalIdentifierAsName, logIllegalImportReassignment, logImplicitDependantCannotBeExternal, logImplicitDependantIsNotIncluded, logImportAttributeIsInvalid, logImportOptionsAreInvalid, logIncompatibleExportOptionValue, logInconsistentImportAttributes, logInputHookInOutputPlugin, logInternalIdCannotBeExternal, logInvalidAddonPluginHook, logInvalidAnnotation, logInvalidExportOptionValue, logInvalidFormatForTopLevelAwait, logInvalidFunctionPluginHook, logInvalidLogPosition, logInvalidOption, logInvalidRollupPhaseForAddWatchFile, logInvalidRollupPhaseForChunkEmission, logInvalidSetAssetSourceCall, logInvalidSourcemapForError, logLevelPriority, logMissingExport, logMissingFileOrDirOption, logMissingGlobalName, logMissingNameOptionForIifeExport, logMissingNameOptionForUmdExport, logMissingNodeBuiltins, logMixedExport, logModuleLevelDirective, logModuleParseError, logNamespaceConflict, logNoAssetSourceSet, logNoTransformMapOrAstWithoutCode, logOptimizeChunkStatus, logPluginError, logShimmedExport, logSourcemapBroken, logSyntheticNamedExportsNeedNamespaceExport, logThisIsUndefined, logUnexpectedNamedImport, logUnexpectedNamespaceReexport, logUnknownOption, logUnresolvedEntry, logUnresolvedImplicitDependant, logUnresolvedImport, logUnresolvedImportTreatedAsExternal, logUnusedExternalImports, normalize, parseAst, parseAstAsync, printQuotedStringList, relative, relativeId, warnDeprecation };
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/dist/native.js CHANGED
@@ -46,9 +46,10 @@ If this is important to you, please consider supporting Rollup to make a native
46
46
 
47
47
  const packageBase = imported.musl && isMusl() ? imported.musl : imported.base;
48
48
  const localName = `./rollup.${packageBase}.node`;
49
- const { parse, xxhashBase64Url } = require(
49
+ const { parse, parseAsync, xxhashBase64Url } = require(
50
50
  existsSync(join(__dirname, localName)) ? localName : `@rollup/rollup-${packageBase}`
51
51
  );
52
52
 
53
53
  module.exports.parse = parse;
54
+ module.exports.parseAsync = parseAsync;
54
55
  module.exports.xxhashBase64Url = xxhashBase64Url;
@@ -1,3 +1,4 @@
1
- import type { ParseAst } from './rollup';
1
+ import type { ParseAst, ParseAstAsync } from './rollup';
2
2
 
3
3
  export const parseAst: ParseAst;
4
+ export const parseAstAsync: ParseAstAsync;
package/dist/parseAst.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -18,4 +18,5 @@ require('node:path');
18
18
 
19
19
 
20
20
  exports.parseAst = parseAst_js.parseAst;
21
+ exports.parseAstAsync = parseAst_js.parseAstAsync;
21
22
  //# sourceMappingURL=parseAst.js.map
package/dist/rollup.d.ts CHANGED
@@ -206,6 +206,16 @@ export type ParseAst = (
206
206
  options?: { allowReturnOutsideFunction?: boolean }
207
207
  ) => AstNode;
208
208
 
209
+ // declare AbortSignal here for environments without DOM lib or @types/node
210
+ declare global {
211
+ interface AbortSignal {}
212
+ }
213
+
214
+ export type ParseAstAsync = (
215
+ input: string,
216
+ options?: { allowReturnOutsideFunction?: boolean; signal?: AbortSignal }
217
+ ) => Promise<AstNode>;
218
+
209
219
  export interface PluginContext extends MinimalPluginContext {
210
220
  addWatchFile: (id: string) => void;
211
221
  cache: PluginCache;
package/dist/rollup.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -777,7 +777,8 @@ function logModuleParseError(error, moduleId) {
777
777
  cause: error,
778
778
  code: PARSE_ERROR,
779
779
  id: moduleId,
780
- message
780
+ message,
781
+ stack: error.stack
781
782
  };
782
783
  }
783
784
  function logPluginError(error, plugin, { hook, id } = {}) {
@@ -2191,7 +2192,14 @@ function getReadStringFunction(astBuffer) {
2191
2192
  const parseAst = (input, { allowReturnOutsideFunction = false } = {}) => {
2192
2193
  const astBuffer = native_js.parse(input, allowReturnOutsideFunction);
2193
2194
  const readString = getReadStringFunction(astBuffer);
2194
- return convertProgram(astBuffer.buffer, readString);
2195
+ const result = convertProgram(astBuffer.buffer, readString);
2196
+ return result;
2197
+ };
2198
+ const parseAstAsync = async (input, { allowReturnOutsideFunction = false, signal } = {}) => {
2199
+ const astBuffer = await native_js.parseAsync(input, allowReturnOutsideFunction, signal);
2200
+ const readString = getReadStringFunction(astBuffer);
2201
+ const result = convertProgram(astBuffer.buffer, readString);
2202
+ return result;
2195
2203
  };
2196
2204
 
2197
2205
  exports.ANNOTATION_KEY = ANNOTATION_KEY;
@@ -2319,6 +2327,7 @@ exports.logUnresolvedImportTreatedAsExternal = logUnresolvedImportTreatedAsExter
2319
2327
  exports.logUnusedExternalImports = logUnusedExternalImports;
2320
2328
  exports.normalize = normalize;
2321
2329
  exports.parseAst = parseAst;
2330
+ exports.parseAstAsync = parseAstAsync;
2322
2331
  exports.printQuotedStringList = printQuotedStringList;
2323
2332
  exports.relative = relative;
2324
2333
  exports.relativeId = relativeId;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -31,7 +31,7 @@ function _interopNamespaceDefault(e) {
31
31
 
32
32
  const tty__namespace = /*#__PURE__*/_interopNamespaceDefault(tty);
33
33
 
34
- var version = "4.1.6";
34
+ var version = "4.2.0";
35
35
 
36
36
  function ensureArray$1(items) {
37
37
  if (Array.isArray(items)) {
@@ -14352,7 +14352,7 @@ class Module {
14352
14352
  }
14353
14353
  return { source, usesTopLevelAwait };
14354
14354
  }
14355
- setSource({ ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, ...moduleOptions }) {
14355
+ async setSource({ ast, code, customTransformCache, originalCode, originalSourcemap, resolvedIds, sourcemapChain, transformDependencies, transformFiles, ...moduleOptions }) {
14356
14356
  if (code.startsWith('#!')) {
14357
14357
  const shebangEndPosition = code.indexOf('\n');
14358
14358
  this.shebang = code.slice(2, shebangEndPosition);
@@ -14377,7 +14377,7 @@ class Module {
14377
14377
  this.transformDependencies = transformDependencies;
14378
14378
  this.customTransformCache = customTransformCache;
14379
14379
  this.updateOptions(moduleOptions);
14380
- const moduleAst = ast ?? this.tryParse();
14380
+ const moduleAst = ast ?? (await this.tryParseAsync());
14381
14381
  timeEnd('generate ast', 3);
14382
14382
  timeStart('analyze ast', 3);
14383
14383
  this.resolvedIds = resolvedIds ?? Object.create(null);
@@ -14779,6 +14779,14 @@ class Module {
14779
14779
  return this.error(parseAst_js.logModuleParseError(error_, this.id), error_.pos);
14780
14780
  }
14781
14781
  }
14782
+ async tryParseAsync() {
14783
+ try {
14784
+ return (await parseAst_js.parseAstAsync(this.info.code));
14785
+ }
14786
+ catch (error_) {
14787
+ return this.error(parseAst_js.logModuleParseError(error_, this.id), error_.pos);
14788
+ }
14789
+ }
14782
14790
  }
14783
14791
  // if there is a cyclic import in the reexport chain, we should not
14784
14792
  // import from the original module but from the cyclic module to not
@@ -18639,11 +18647,11 @@ class ModuleLoader {
18639
18647
  for (const emittedFile of cachedModule.transformFiles)
18640
18648
  this.pluginDriver.emitFile(emittedFile);
18641
18649
  }
18642
- module.setSource(cachedModule);
18650
+ await module.setSource(cachedModule);
18643
18651
  }
18644
18652
  else {
18645
18653
  module.updateOptions(sourceDescription);
18646
- module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onLog));
18654
+ await module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onLog));
18647
18655
  }
18648
18656
  }
18649
18657
  async awaitLoadModulesPromise() {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  @license
3
- Rollup.js v4.1.6
4
- Tue, 31 Oct 2023 05:44:37 GMT - commit 5901e545697b36326110d89ed02964fdaffd9f6f
3
+ Rollup.js v4.2.0
4
+ Tue, 31 Oct 2023 08:09:58 GMT - commit fbf806aceffd822d43e4603b664c54165c72cf36
5
5
 
6
6
  https://github.com/rollup/rollup
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup",
3
- "version": "4.1.6",
3
+ "version": "4.2.0",
4
4
  "description": "Next-generation ES module bundler",
5
5
  "main": "dist/rollup.js",
6
6
  "module": "dist/es/rollup.js",
@@ -100,18 +100,18 @@
100
100
  "homepage": "https://rollupjs.org/",
101
101
  "optionalDependencies": {
102
102
  "fsevents": "~2.3.2",
103
- "@rollup/rollup-darwin-arm64": "4.1.6",
104
- "@rollup/rollup-android-arm64": "4.1.6",
105
- "@rollup/rollup-win32-arm64-msvc": "4.1.6",
106
- "@rollup/rollup-linux-arm64-gnu": "4.1.6",
107
- "@rollup/rollup-linux-arm64-musl": "4.1.6",
108
- "@rollup/rollup-android-arm-eabi": "4.1.6",
109
- "@rollup/rollup-linux-arm-gnueabihf": "4.1.6",
110
- "@rollup/rollup-win32-ia32-msvc": "4.1.6",
111
- "@rollup/rollup-darwin-x64": "4.1.6",
112
- "@rollup/rollup-win32-x64-msvc": "4.1.6",
113
- "@rollup/rollup-linux-x64-gnu": "4.1.6",
114
- "@rollup/rollup-linux-x64-musl": "4.1.6"
103
+ "@rollup/rollup-darwin-arm64": "4.2.0",
104
+ "@rollup/rollup-android-arm64": "4.2.0",
105
+ "@rollup/rollup-win32-arm64-msvc": "4.2.0",
106
+ "@rollup/rollup-linux-arm64-gnu": "4.2.0",
107
+ "@rollup/rollup-linux-arm64-musl": "4.2.0",
108
+ "@rollup/rollup-android-arm-eabi": "4.2.0",
109
+ "@rollup/rollup-linux-arm-gnueabihf": "4.2.0",
110
+ "@rollup/rollup-win32-ia32-msvc": "4.2.0",
111
+ "@rollup/rollup-darwin-x64": "4.2.0",
112
+ "@rollup/rollup-win32-x64-msvc": "4.2.0",
113
+ "@rollup/rollup-linux-x64-gnu": "4.2.0",
114
+ "@rollup/rollup-linux-x64-musl": "4.2.0"
115
115
  },
116
116
  "devDependenciesComments": {
117
117
  "@rollup/plugin-typescript": "It appears that 11.1.3 breaks sourcemaps"