@codingame/monaco-vscode-api 1.79.1 → 1.79.2-next.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.
- package/README.md +11 -2
- package/dist/api.js +10 -8
- package/dist/composite.d.ts +65 -0
- package/dist/configurationRegistry.d.ts +212 -0
- package/dist/contextkey.d.ts +1 -1
- package/dist/default-extensions/json.js +1 -0
- package/dist/default-extensions/theme-defaults.js +2 -2
- package/dist/editorBrowser.d.ts +272 -3
- package/dist/event.d.ts +6 -1
- package/dist/{extension-tools-0c4c1ad7.js → extension-tools-3c2bf0a4.js} +698 -507
- package/dist/extensions.d.ts +3 -2
- package/dist/extensions.d2.ts +6 -17
- package/dist/extensionsRegistry.d.ts +15 -9
- package/dist/files.d.ts +71 -7
- package/dist/jsonSchema.d.ts +1 -1
- package/dist/keybinding.d.ts +2 -2
- package/dist/languageFeatures.d.ts +703 -61
- package/dist/monaco.d.ts +5 -4
- package/dist/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/browser/notebookEditor.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2 -0
- package/dist/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +2 -1
- package/dist/platform.d.ts +11 -0
- package/dist/rollup-extension-directory-plugin.js +1 -1
- package/dist/rollup-vsix-plugin.js +2 -2
- package/dist/service-override/configuration.d.ts +5 -206
- package/dist/service-override/dialogs.js +16 -1
- package/dist/service-override/files.d.ts +2 -2
- package/dist/service-override/files.js +1 -1
- package/dist/service-override/markers.d.ts +7 -0
- package/dist/service-override/markers.js +6 -0
- package/dist/service-override/output.d.ts +7 -0
- package/dist/service-override/output.js +22 -0
- package/dist/service-override/preferences.js +7 -1
- package/dist/service-override/quickaccess.js +0 -9
- package/dist/service-override/search.d.ts +7 -0
- package/dist/service-override/search.js +19 -0
- package/dist/service-override/terminal.d.ts +607 -0
- package/dist/service-override/terminal.js +98 -0
- package/dist/service-override/tools/editor.js +1 -1
- package/dist/service-override/views.d.ts +561 -335
- package/dist/service-override/views.js +51 -11
- package/dist/services.d.ts +2627 -108
- package/dist/services.js +3 -0
- package/dist/severity.d.ts +16 -0
- package/dist/uri.d.ts +22 -11
- package/dist/views.d.ts +270 -0
- package/dist/vscode/vs/base/common/processes.js +24 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/decorations.js +20 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/delegatingEditorImpl.js +106 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorSash.js +59 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.contribution.js +41 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.js +369 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffModel.js +247 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/lineAlignment.js +179 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/overviewRulerPart.js +121 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/style.css.js +4 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.js +184 -0
- package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/utils.js +88 -0
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +38 -1
- package/dist/vscode/vs/platform/extensionManagement/common/extensionManagementUtil.js +5 -1
- package/dist/vscode/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +13 -5
- package/dist/vscode/vs/platform/files/common/fileService.js +43 -5
- package/dist/vscode/vs/platform/files/common/files.js +3 -1
- package/dist/vscode/vs/platform/languagePacks/common/languagePacks.js +4 -1
- package/dist/vscode/vs/platform/log/common/bufferLog.js +34 -0
- package/dist/vscode/vs/platform/log/common/fileLog.js +105 -0
- package/dist/vscode/vs/platform/quickinput/browser/quickPickPin.js +1 -1
- package/dist/vscode/vs/platform/remote/common/remoteAuthorityResolver.js +20 -1
- package/dist/vscode/vs/platform/request/browser/requestService.js +1 -1
- package/dist/vscode/vs/platform/request/common/request.js +3 -3
- package/dist/vscode/vs/platform/storage/common/storage.js +3 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +39 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +565 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +27 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +22 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +46 -0
- package/dist/vscode/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +80 -0
- package/dist/vscode/vs/platform/terminal/common/environmentVariable.js +7 -0
- package/dist/vscode/vs/platform/terminal/common/environmentVariableCollection.js +196 -0
- package/dist/vscode/vs/platform/terminal/common/environmentVariableShared.js +23 -0
- package/dist/vscode/vs/platform/terminal/common/terminal.js +21 -1
- package/dist/vscode/vs/platform/terminal/common/terminalDataBuffering.js +45 -0
- package/dist/vscode/vs/platform/terminal/common/terminalEnvironment.js +37 -0
- package/dist/vscode/vs/platform/terminal/common/terminalPlatformConfiguration.js +622 -0
- package/dist/vscode/vs/platform/terminal/common/terminalProfiles.js +107 -0
- package/dist/vscode/vs/platform/terminal/common/terminalRecorder.js +66 -0
- package/dist/vscode/vs/platform/terminal/common/terminalStrings.js +16 -0
- package/dist/vscode/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +321 -0
- package/dist/vscode/vs/platform/userDataSync/common/settingsMerge.js +39 -1
- package/dist/vscode/vs/platform/userDataSync/common/userDataSync.js +19 -0
- package/dist/vscode/vs/platform/window/common/window.js +7 -1
- package/dist/vscode/vs/platform/workspace/common/canonicalUri.js +3 -0
- package/dist/vscode/vs/platform/workspace/common/virtualWorkspace.js +4 -1
- package/dist/vscode/vs/platform/workspaces/common/workspaces.js +2 -2
- package/dist/vscode/vs/workbench/api/browser/mainThreadCommands.js +2 -3
- package/dist/vscode/vs/workbench/api/browser/mainThreadEditorTabs.js +473 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadLanguageFeatures.js +45 -38
- package/dist/vscode/vs/workbench/api/browser/mainThreadSearch.js +146 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadStatusBar.js +33 -52
- package/dist/vscode/vs/workbench/api/browser/mainThreadTerminalService.js +395 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadTheming.js +22 -0
- package/dist/vscode/vs/workbench/api/browser/mainThreadTreeViews.js +10 -5
- package/dist/vscode/vs/workbench/api/browser/mainThreadWindow.js +11 -4
- package/dist/vscode/vs/workbench/api/browser/mainThreadWorkspace.js +34 -11
- package/dist/vscode/vs/workbench/api/browser/statusBarExtensionPoint.js +81 -0
- package/dist/vscode/vs/workbench/api/common/extHost.protocol.js +7 -2
- package/dist/vscode/vs/workbench/api/common/extHostDebugService.js +4 -13
- package/dist/vscode/vs/workbench/api/common/extHostExtensionService.js +30 -15
- package/dist/vscode/vs/workbench/api/common/extHostFileSystemConsumer.js +20 -6
- package/dist/vscode/vs/workbench/api/common/extHostLanguageFeatures.js +41 -8
- package/dist/vscode/vs/workbench/api/common/extHostManagedSockets.js +3 -0
- package/dist/vscode/vs/workbench/api/common/extHostSearch.js +109 -0
- package/dist/vscode/vs/workbench/api/common/extHostStatusBar.js +33 -6
- package/dist/vscode/vs/workbench/api/common/extHostTerminalService.js +879 -1
- package/dist/vscode/vs/workbench/api/common/extHostTheming.js +38 -0
- package/dist/vscode/vs/workbench/api/common/extHostTreeViews.js +8 -5
- package/dist/vscode/vs/workbench/api/common/extHostTypeConverters.js +15 -17
- package/dist/vscode/vs/workbench/api/common/extHostTypes.js +117 -4
- package/dist/vscode/vs/workbench/api/common/extHostWindow.js +28 -6
- package/dist/vscode/vs/workbench/api/common/extHostWorkspace.js +28 -0
- package/dist/vscode/vs/workbench/api/common/shared/dataTransferCache.js +11 -14
- package/dist/vscode/vs/workbench/api/node/extHostTerminalService.js +22 -0
- package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +2 -1
- package/dist/vscode/vs/workbench/browser/actions/windowActions.js +2 -2
- package/dist/vscode/vs/workbench/browser/dnd.js +56 -2
- package/dist/vscode/vs/workbench/browser/parts/compositePart.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/dialogs/dialogHandler.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +1 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editor.js +1 -0
- package/dist/vscode/vs/workbench/browser/parts/editor/editorCommands.js +9 -10
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupView.js +15 -9
- package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupWatermark.js +13 -17
- package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/editorsObserver.js +2 -2
- package/dist/vscode/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/noTabsTitleControl.js +3 -1
- package/dist/vscode/vs/workbench/browser/parts/editor/tabsTitleControl.js +60 -11
- package/dist/vscode/vs/workbench/browser/parts/editor/textDiffEditor.js +16 -10
- package/dist/vscode/vs/workbench/browser/parts/editor/textResourceEditor.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +1 -1
- package/dist/vscode/vs/workbench/browser/parts/views/checkbox.js +10 -0
- package/dist/vscode/vs/workbench/browser/parts/views/treeView.js +78 -14
- package/dist/vscode/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
- package/dist/vscode/vs/workbench/browser/workbench.contribution.js +65 -6
- package/dist/vscode/vs/workbench/common/configuration.js +8 -1
- package/dist/vscode/vs/workbench/common/contextkeys.js +9 -1
- package/dist/vscode/vs/workbench/common/editor/editorGroupModel.js +5 -1
- package/dist/vscode/vs/workbench/common/editor/resourceEditorInput.js +6 -3
- package/dist/vscode/vs/workbench/common/editor/textResourceEditorInput.js +9 -6
- package/dist/vscode/vs/workbench/common/editor.js +1 -5
- package/dist/vscode/vs/workbench/common/resources.js +111 -34
- package/dist/vscode/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +1 -1
- package/dist/vscode/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +1 -1
- package/dist/vscode/vs/workbench/contrib/chat/browser/chat.js +3 -0
- package/dist/vscode/vs/workbench/contrib/chat/common/chatService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +6 -4
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +250 -0
- package/dist/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput.js +290 -0
- package/dist/vscode/vs/workbench/contrib/customEditor/common/customEditor.js +3 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugActionViewItems.js +1 -0
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugCommands.js +2 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +20 -20
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorActions.js +5 -3
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorContribution.js +5 -2
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugHover.js +33 -6
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugSession.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/debugTaskRunner.js +1 -1
- package/dist/vscode/vs/workbench/contrib/debug/browser/repl.js +3 -3
- package/dist/vscode/vs/workbench/contrib/debug/common/debugModel.js +29 -17
- package/dist/vscode/vs/workbench/contrib/debug/common/debugStorage.js +11 -10
- package/dist/vscode/vs/workbench/contrib/debug/common/debugger.js +10 -6
- package/dist/vscode/vs/workbench/contrib/extensions/browser/extensionsActions.js +2514 -0
- package/dist/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons.js +82 -0
- package/dist/vscode/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/extensions/common/extensions.js +6 -1
- package/dist/vscode/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +16 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput.js +2 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +2 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerService.js +10 -6
- package/dist/vscode/vs/workbench/contrib/files/browser/explorerViewlet.js +3 -18
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.contribution.js +37 -2
- package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.js +65 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/fileCommands.js +3 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/fileConstants.js +3 -1
- package/dist/vscode/vs/workbench/contrib/files/browser/files.contribution.js +41 -6
- package/dist/vscode/vs/workbench/contrib/files/browser/files.js +1 -0
- package/dist/vscode/vs/workbench/contrib/files/browser/views/explorerView.js +3 -3
- package/dist/vscode/vs/workbench/contrib/files/browser/views/explorerViewer.js +6 -2
- package/dist/vscode/vs/workbench/contrib/files/common/explorerModel.js +16 -9
- package/dist/vscode/vs/workbench/contrib/files/common/files.js +1 -6
- package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +200 -0
- package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markers.contribution.js +586 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersFilterOptions.js +75 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersModel.js +201 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersTable.js +451 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersTreeViewer.js +670 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersView.js +857 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersViewActions.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/markersViewActions.js +132 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/media/markers.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/markers/browser/messages.js +171 -0
- package/dist/vscode/vs/workbench/contrib/markers/common/markers.js +15 -1
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +135 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +421 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +55 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +334 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +606 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +36 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/utils.js +68 -0
- package/dist/vscode/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +2 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +158 -0
- package/dist/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser.js +6 -1
- package/dist/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookCommon.js +16 -1
- package/dist/vscode/vs/workbench/contrib/notebook/common/notebookService.js +3 -0
- package/dist/vscode/vs/workbench/contrib/output/browser/logViewer.js +64 -0
- package/dist/vscode/vs/workbench/contrib/output/browser/output.contribution.js +378 -0
- package/dist/vscode/vs/workbench/contrib/output/browser/outputServices.js +39 -3
- package/dist/vscode/vs/workbench/contrib/output/browser/outputView.js +220 -0
- package/dist/vscode/vs/workbench/contrib/output/common/outputChannelModel.js +12 -3
- package/dist/vscode/vs/workbench/contrib/output/common/outputLinkComputer.js +129 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/keybindingWidgets.js +270 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/keybindingsEditor.js +1080 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/keybindings.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/keybindingsEditor.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/preferences.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/media/settingsWidgets.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferences.contribution.js +1154 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesActions.js +94 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesEditor.js +47 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesIcons.js +37 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesRenderers.js +731 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesSearch.js +271 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesWidgets.js +479 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsEditor2.js +1465 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.js +506 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsLayout.js +296 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsSearchMenu.js +79 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsTree.js +1984 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsTreeModels.js +759 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsWidgets.js +1008 -0
- package/dist/vscode/vs/workbench/contrib/preferences/browser/tocTree.js +196 -0
- package/dist/vscode/vs/workbench/contrib/preferences/common/preferences.js +68 -0
- package/dist/vscode/vs/workbench/contrib/preferences/common/preferencesContribution.js +157 -0
- package/dist/vscode/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +67 -0
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +16 -16
- package/dist/vscode/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +1 -2
- package/dist/vscode/vs/workbench/contrib/remote/browser/remoteExplorer.js +23 -2
- package/dist/vscode/vs/workbench/contrib/remote/browser/tunnelView.js +5 -5
- package/dist/vscode/vs/workbench/contrib/search/browser/media/searchview.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/patternInputWidget.js +217 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/replace.js +3 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/replaceContributions.js +7 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/replaceService.js +222 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/search.contribution.js +54 -15
- package/dist/vscode/vs/workbench/contrib/search/browser/searchActionsBase.js +17 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchFindInput.js +41 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchIcons.js +35 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchMessage.js +58 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchModel.js +1842 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchNotebookHelpers.js +49 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchResultsView.js +379 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchView.js +1867 -0
- package/dist/vscode/vs/workbench/contrib/search/browser/searchWidget.js +628 -0
- package/dist/vscode/vs/workbench/contrib/search/common/constants.js +30 -1
- package/dist/vscode/vs/workbench/contrib/search/common/search.js +9 -1
- package/dist/vscode/vs/workbench/contrib/search/common/searchHistoryService.js +42 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +477 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditor.js +697 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +188 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +295 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +135 -0
- package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +268 -0
- package/dist/vscode/vs/workbench/contrib/snippets/browser/tabCompletion.js +2 -2
- package/dist/vscode/vs/workbench/contrib/tasks/common/taskService.js +16 -1
- package/dist/vscode/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +119 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/scrollbar.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/terminal.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/widgets.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/media/xterm.css.js +4 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.contribution.js +238 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalActions.js +1930 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalCommands.js +22 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalConfigHelper.js +213 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +17 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditor.js +186 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +199 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditorService.js +239 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalExtensions.js +22 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalGroup.js +482 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalGroupService.js +372 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcon.js +60 -1
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcons.js +37 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalInstance.js +2123 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalInstanceService.js +79 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalMainContribution.js +82 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalMenus.js +850 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +142 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +618 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileQuickpick.js +278 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.js +417 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileService.js +213 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalQuickAccess.js +144 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalRunRecentQuickPick.js +267 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalService.js +1063 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalStatusList.js +108 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTabbedView.js +417 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTabsList.js +680 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTooltip.js +72 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalUri.js +39 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalView.js +535 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +469 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +97 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +56 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
- package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +587 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/environmentVariable.js +3 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/environmentVariableService.js +94 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/history.js +356 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminal.js +266 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +23 -16
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalConfiguration.js +965 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalContextKey.js +157 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalEnvironment.js +272 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalExtensionPoints.js +27 -0
- package/dist/vscode/vs/workbench/contrib/terminal/common/terminalStrings.js +86 -0
- package/dist/vscode/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.js +46 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/links/browser/links.js +3 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkProviderService.js +26 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.js +3 -0
- package/dist/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixService.js +143 -0
- package/dist/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.js +85 -0
- package/dist/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.js +52 -0
- package/dist/vscode/vs/workbench/services/actions/common/menusExtensionPoint.js +14 -6
- package/dist/vscode/vs/workbench/services/assignment/common/assignmentService.js +3 -0
- package/dist/vscode/vs/workbench/services/configuration/browser/configurationService.js +13 -13
- package/dist/vscode/vs/workbench/services/configuration/common/configuration.js +2 -1
- package/dist/vscode/vs/workbench/services/configuration/common/configurationEditing.js +2 -2
- package/dist/vscode/vs/workbench/services/configuration/common/jsonEditingService.js +2 -2
- package/dist/vscode/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +302 -0
- package/dist/vscode/vs/workbench/services/dialogs/browser/simpleFileDialog.js +971 -0
- package/dist/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.js +3 -2
- package/dist/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations.js +4 -0
- package/dist/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +2 -0
- package/dist/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.js +3 -0
- package/dist/vscode/vs/workbench/services/extensions/common/extensions.js +14 -2
- package/dist/vscode/vs/workbench/services/extensions/common/extensionsApiProposals.js +10 -1
- package/dist/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +70 -3
- package/dist/vscode/vs/workbench/services/hover/browser/hoverService.js +1 -1
- package/dist/vscode/vs/workbench/services/hover/browser/hoverWidget.js +2 -1
- package/dist/vscode/vs/workbench/services/hover/browser/media/hover.css.js +1 -1
- package/dist/vscode/vs/workbench/services/keybinding/common/keybindingEditing.js +275 -0
- package/dist/vscode/vs/workbench/services/localization/common/locale.js +3 -0
- package/dist/vscode/vs/workbench/services/log/common/logConstants.js +2 -0
- package/dist/vscode/vs/workbench/services/output/common/output.js +4 -1
- package/dist/vscode/vs/workbench/services/preferences/common/preferences.js +22 -1
- package/dist/vscode/vs/workbench/services/preferences/common/preferencesModels.js +6 -0
- package/dist/vscode/vs/workbench/services/preferences/common/preferencesValidation.js +37 -1
- package/dist/vscode/vs/workbench/services/remote/common/remoteAgentService.js +69 -0
- package/dist/vscode/vs/workbench/services/remote/common/remoteExplorerService.js +66 -27
- package/dist/vscode/vs/workbench/services/search/common/fileSearchManager.js +265 -0
- package/dist/vscode/vs/workbench/services/search/common/queryBuilder.js +6 -0
- package/dist/vscode/vs/workbench/services/search/common/replace.js +203 -0
- package/dist/vscode/vs/workbench/services/search/common/search.js +227 -1
- package/dist/vscode/vs/workbench/services/search/common/searchExtTypes.js +6 -0
- package/dist/vscode/vs/workbench/services/search/common/searchHelpers.js +72 -0
- package/dist/vscode/vs/workbench/services/search/common/searchService.js +355 -0
- package/dist/vscode/vs/workbench/services/search/common/textSearchManager.js +309 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +399 -0
- package/dist/vscode/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
- package/dist/vscode/vs/workbench/services/terminal/common/embedderTerminalService.js +3 -0
- package/dist/vscode/vs/workbench/services/textfile/browser/textFileService.js +1 -1
- package/dist/vscode/vs/workbench/services/textfile/common/textFileEditorModel.js +10 -3
- package/dist/vscode/vs/workbench/services/themes/browser/fileIconThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/browser/productIconThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/themes/common/colorThemeData.js +3 -3
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput.js +6 -4
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorModel.js +3 -0
- package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.js +4 -0
- package/dist/vscode/vs/workbench/services/userActivity/common/userActivityRegistry.js +15 -0
- package/dist/vscode/vs/workbench/services/userActivity/common/userActivityService.js +37 -0
- package/dist/vscode/vs/workbench/services/userDataSync/common/userDataSync.js +7 -0
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.js +40 -0
- package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyService.js +12 -0
- package/dist/vscode/vs/workbench/services/workspaces/common/canonicalUriService.js +19 -0
- package/dist/vscode-default-extensions/css/syntaxes/css.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/json/package.json.js +1 -1
- package/dist/vscode-default-extensions/json/syntaxes/JSONC.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/json/syntaxes/JSONL.tmLanguage.json.extensionResource.js +2 -0
- package/dist/vscode-default-extensions/latex/syntaxes/Bibtex.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/LaTeX.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/TeX.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/lua/syntaxes/lua.tmLanguage.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/perl/package.json.js +1 -1
- package/dist/vscode-default-extensions/php/snippets/php.code-snippets.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/sql/language-configuration.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-abyss/themes/abyss-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/package.json.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/dark_modern.json.extensionResource.js +2 -0
- package/dist/vscode-default-extensions/theme-defaults/themes/dark_vs.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/hc_black.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/hc_light.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-defaults/themes/light_modern.json.extensionResource.js +2 -0
- package/dist/vscode-default-extensions/theme-defaults/themes/light_vs.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-kimbie-dark/themes/kimbie-dark-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-monokai/themes/monokai-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-quietlight/themes/quietlight-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-red/themes/Red-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-seti/icons/vs-seti-icon-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-solarized-light/themes/solarized-light-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-color-theme.json.extensionResource.js +1 -1
- package/dist/vscode-default-extensions/vb/language-configuration.json.extensionResource.js +1 -1
- package/dist/vscode-services/env.js +4 -2
- package/dist/vscode-services/extHost.js +32 -48
- package/dist/vscode-services/missing-services.js +407 -29
- package/dist/vscode-services/window.js +59 -65
- package/dist/vscode-services/workspace.js +19 -5
- package/dist/workers/outputLinkComputer.worker.d.ts +2 -0
- package/dist/workers/outputLinkComputer.worker.js +3 -0
- package/dist/workspace.d.ts +1 -1
- package/monaco-editor-treemending.patch +1305 -1184
- package/package.json +65 -19
- package/dist/activity.d.ts +0 -2802
- package/dist/collections.d.ts +0 -7
- package/dist/colorRegistry.d.ts +0 -710
- package/dist/vscode/vs/platform/product/common/product.js +0 -48
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionFollowups.js +0 -30
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionInputPart.js +0 -196
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionListRenderer.js +0 -622
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionOptions.js +0 -77
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionWidget.js +0 -311
- package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/media/interactiveSession.css.js +0 -4
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionContextKeys.js +0 -56
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionModel.js +0 -305
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionService.js +0 -13
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionServiceImpl.js +0 -379
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionViewModel.js +0 -207
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionWidgetHistoryService.js +0 -3
- package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionWordCounter.js +0 -25
- package/dist/vscode-default-extensions/theme-defaults/themes/dark_plus_experimental.json.extensionResource.js +0 -2
- package/dist/vscode-default-extensions/theme-defaults/themes/light_plus_experimental.json.extensionResource.js +0 -2
|
@@ -1421,15 +1421,15 @@ function getParseErrorMessage(errorCode) {
|
|
|
1421
1421
|
|
|
1422
1422
|
/*
|
|
1423
1423
|
@license
|
|
1424
|
-
Rollup.js v3.
|
|
1425
|
-
Mon,
|
|
1424
|
+
Rollup.js v3.25.1
|
|
1425
|
+
Mon, 12 Jun 2023 04:38:12 GMT - commit b1341bf9cd719670a670905e0308418b37621d70
|
|
1426
1426
|
|
|
1427
1427
|
https://github.com/rollup/rollup
|
|
1428
1428
|
|
|
1429
1429
|
Released under the MIT License.
|
|
1430
1430
|
*/
|
|
1431
1431
|
|
|
1432
|
-
var version$1 = "3.
|
|
1432
|
+
var version$1 = "3.25.1";
|
|
1433
1433
|
|
|
1434
1434
|
const comma = ','.charCodeAt(0);
|
|
1435
1435
|
const semicolon = ';'.charCodeAt(0);
|
|
@@ -3385,6 +3385,89 @@ const EMPTY_SET = Object.freeze(new (class extends Set {
|
|
|
3385
3385
|
}
|
|
3386
3386
|
})());
|
|
3387
3387
|
|
|
3388
|
+
const RESERVED_NAMES = new Set([
|
|
3389
|
+
'await',
|
|
3390
|
+
'break',
|
|
3391
|
+
'case',
|
|
3392
|
+
'catch',
|
|
3393
|
+
'class',
|
|
3394
|
+
'const',
|
|
3395
|
+
'continue',
|
|
3396
|
+
'debugger',
|
|
3397
|
+
'default',
|
|
3398
|
+
'delete',
|
|
3399
|
+
'do',
|
|
3400
|
+
'else',
|
|
3401
|
+
'enum',
|
|
3402
|
+
'eval',
|
|
3403
|
+
'export',
|
|
3404
|
+
'extends',
|
|
3405
|
+
'false',
|
|
3406
|
+
'finally',
|
|
3407
|
+
'for',
|
|
3408
|
+
'function',
|
|
3409
|
+
'if',
|
|
3410
|
+
'implements',
|
|
3411
|
+
'import',
|
|
3412
|
+
'in',
|
|
3413
|
+
'instanceof',
|
|
3414
|
+
'interface',
|
|
3415
|
+
'let',
|
|
3416
|
+
'NaN',
|
|
3417
|
+
'new',
|
|
3418
|
+
'null',
|
|
3419
|
+
'package',
|
|
3420
|
+
'private',
|
|
3421
|
+
'protected',
|
|
3422
|
+
'public',
|
|
3423
|
+
'return',
|
|
3424
|
+
'static',
|
|
3425
|
+
'super',
|
|
3426
|
+
'switch',
|
|
3427
|
+
'this',
|
|
3428
|
+
'throw',
|
|
3429
|
+
'true',
|
|
3430
|
+
'try',
|
|
3431
|
+
'typeof',
|
|
3432
|
+
'undefined',
|
|
3433
|
+
'var',
|
|
3434
|
+
'void',
|
|
3435
|
+
'while',
|
|
3436
|
+
'with',
|
|
3437
|
+
'yield'
|
|
3438
|
+
]);
|
|
3439
|
+
const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
3440
|
+
|
|
3441
|
+
const illegalCharacters = /[^\w$]/g;
|
|
3442
|
+
const startsWithDigit = (value) => /\d/.test(value[0]);
|
|
3443
|
+
const needsEscape = (value) => startsWithDigit(value) || RESERVED_NAMES$1.has(value) || value === 'arguments';
|
|
3444
|
+
function isLegal(value) {
|
|
3445
|
+
if (needsEscape(value)) {
|
|
3446
|
+
return false;
|
|
3447
|
+
}
|
|
3448
|
+
return !illegalCharacters.test(value);
|
|
3449
|
+
}
|
|
3450
|
+
function makeLegal(value) {
|
|
3451
|
+
value = value
|
|
3452
|
+
.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
|
|
3453
|
+
.replace(illegalCharacters, '_');
|
|
3454
|
+
if (needsEscape(value))
|
|
3455
|
+
value = `_${value}`;
|
|
3456
|
+
return value || '_';
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
const LOGLEVEL_SILENT = 'silent';
|
|
3460
|
+
const LOGLEVEL_ERROR = 'error';
|
|
3461
|
+
const LOGLEVEL_WARN = 'warn';
|
|
3462
|
+
const LOGLEVEL_INFO = 'info';
|
|
3463
|
+
const LOGLEVEL_DEBUG = 'debug';
|
|
3464
|
+
const logLevelPriority = {
|
|
3465
|
+
[LOGLEVEL_DEBUG]: 0,
|
|
3466
|
+
[LOGLEVEL_INFO]: 1,
|
|
3467
|
+
[LOGLEVEL_SILENT]: 3,
|
|
3468
|
+
[LOGLEVEL_WARN]: 2
|
|
3469
|
+
};
|
|
3470
|
+
|
|
3388
3471
|
function getLocator(source, options) {
|
|
3389
3472
|
if (options === void 0) { options = {}; }
|
|
3390
3473
|
var offsetLine = options.offsetLine || 0;
|
|
@@ -3497,6 +3580,12 @@ function isValidUrl(url) {
|
|
|
3497
3580
|
function getRollupUrl(snippet) {
|
|
3498
3581
|
return `https://rollupjs.org/${snippet}`;
|
|
3499
3582
|
}
|
|
3583
|
+
function addTrailingSlashIfMissed(url) {
|
|
3584
|
+
if (!url.endsWith('/')) {
|
|
3585
|
+
return url + '/';
|
|
3586
|
+
}
|
|
3587
|
+
return url;
|
|
3588
|
+
}
|
|
3500
3589
|
|
|
3501
3590
|
// troubleshooting
|
|
3502
3591
|
const URL_AVOIDING_EVAL = 'troubleshooting/#avoiding-eval';
|
|
@@ -3556,21 +3645,21 @@ function augmentCodeLocation(properties, pos, source, id) {
|
|
|
3556
3645
|
}
|
|
3557
3646
|
// Error codes should be sorted alphabetically while errors should be sorted by
|
|
3558
3647
|
// error code below
|
|
3559
|
-
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NOT_FOUND = 'FILE_NOT_FOUND', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INCONSISTENT_IMPORT_ASSERTIONS = 'INCONSISTENT_IMPORT_ASSERTIONS', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
3560
|
-
function
|
|
3648
|
+
const ADDON_ERROR = 'ADDON_ERROR', ALREADY_CLOSED = 'ALREADY_CLOSED', AMBIGUOUS_EXTERNAL_NAMESPACES = 'AMBIGUOUS_EXTERNAL_NAMESPACES', ANONYMOUS_PLUGIN_CACHE = 'ANONYMOUS_PLUGIN_CACHE', ASSET_NOT_FINALISED = 'ASSET_NOT_FINALISED', ASSET_NOT_FOUND = 'ASSET_NOT_FOUND', ASSET_SOURCE_ALREADY_SET = 'ASSET_SOURCE_ALREADY_SET', ASSET_SOURCE_MISSING = 'ASSET_SOURCE_MISSING', BAD_LOADER = 'BAD_LOADER', CANNOT_CALL_NAMESPACE = 'CANNOT_CALL_NAMESPACE', CANNOT_EMIT_FROM_OPTIONS_HOOK = 'CANNOT_EMIT_FROM_OPTIONS_HOOK', CHUNK_NOT_GENERATED = 'CHUNK_NOT_GENERATED', CHUNK_INVALID = 'CHUNK_INVALID', CIRCULAR_DEPENDENCY = 'CIRCULAR_DEPENDENCY', CIRCULAR_REEXPORT = 'CIRCULAR_REEXPORT', CYCLIC_CROSS_CHUNK_REEXPORT = 'CYCLIC_CROSS_CHUNK_REEXPORT', DEPRECATED_FEATURE = 'DEPRECATED_FEATURE', DUPLICATE_PLUGIN_NAME = 'DUPLICATE_PLUGIN_NAME', EMPTY_BUNDLE = 'EMPTY_BUNDLE', EVAL = 'EVAL', EXTERNAL_SYNTHETIC_EXPORTS = 'EXTERNAL_SYNTHETIC_EXPORTS', FILE_NAME_CONFLICT = 'FILE_NAME_CONFLICT', FILE_NOT_FOUND = 'FILE_NOT_FOUND', FIRST_SIDE_EFFECT = 'FIRST_SIDE_EFFECT', ILLEGAL_IDENTIFIER_AS_NAME = 'ILLEGAL_IDENTIFIER_AS_NAME', ILLEGAL_REASSIGNMENT = 'ILLEGAL_REASSIGNMENT', INCONSISTENT_IMPORT_ASSERTIONS = 'INCONSISTENT_IMPORT_ASSERTIONS', INPUT_HOOK_IN_OUTPUT_PLUGIN = 'INPUT_HOOK_IN_OUTPUT_PLUGIN', INVALID_CHUNK = 'INVALID_CHUNK', INVALID_EXPORT_OPTION = 'INVALID_EXPORT_OPTION', INVALID_EXTERNAL_ID = 'INVALID_EXTERNAL_ID', INVALID_LOG_POSITION = 'INVALID_LOG_POSITION', INVALID_OPTION = 'INVALID_OPTION', INVALID_PLUGIN_HOOK = 'INVALID_PLUGIN_HOOK', INVALID_ROLLUP_PHASE = 'INVALID_ROLLUP_PHASE', INVALID_SETASSETSOURCE = 'INVALID_SETASSETSOURCE', INVALID_TLA_FORMAT = 'INVALID_TLA_FORMAT', MISSING_EXPORT = 'MISSING_EXPORT', MISSING_GLOBAL_NAME = 'MISSING_GLOBAL_NAME', MISSING_IMPLICIT_DEPENDANT = 'MISSING_IMPLICIT_DEPENDANT', MISSING_NAME_OPTION_FOR_IIFE_EXPORT = 'MISSING_NAME_OPTION_FOR_IIFE_EXPORT', MISSING_NODE_BUILTINS = 'MISSING_NODE_BUILTINS', MISSING_OPTION = 'MISSING_OPTION', MIXED_EXPORTS = 'MIXED_EXPORTS', MODULE_LEVEL_DIRECTIVE = 'MODULE_LEVEL_DIRECTIVE', NAMESPACE_CONFLICT = 'NAMESPACE_CONFLICT', NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE = 'NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE', OPTIMIZE_CHUNK_STATUS = 'OPTIMIZE_CHUNK_STATUS', PARSE_ERROR = 'PARSE_ERROR', PLUGIN_ERROR = 'PLUGIN_ERROR', SHIMMED_EXPORT = 'SHIMMED_EXPORT', SOURCEMAP_BROKEN = 'SOURCEMAP_BROKEN', SOURCEMAP_ERROR = 'SOURCEMAP_ERROR', SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT = 'SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT', THIS_IS_UNDEFINED = 'THIS_IS_UNDEFINED', UNEXPECTED_NAMED_IMPORT = 'UNEXPECTED_NAMED_IMPORT', UNKNOWN_OPTION = 'UNKNOWN_OPTION', UNRESOLVED_ENTRY = 'UNRESOLVED_ENTRY', UNRESOLVED_IMPORT = 'UNRESOLVED_IMPORT', UNUSED_EXTERNAL_IMPORT = 'UNUSED_EXTERNAL_IMPORT', VALIDATION_ERROR = 'VALIDATION_ERROR';
|
|
3649
|
+
function logAddonNotGenerated(message, hook, plugin) {
|
|
3561
3650
|
return {
|
|
3562
3651
|
code: ADDON_ERROR,
|
|
3563
3652
|
message: `Could not retrieve "${hook}". Check configuration of plugin "${plugin}".
|
|
3564
3653
|
\tError Message: ${message}`
|
|
3565
3654
|
};
|
|
3566
3655
|
}
|
|
3567
|
-
function
|
|
3656
|
+
function logAlreadyClosed() {
|
|
3568
3657
|
return {
|
|
3569
3658
|
code: ALREADY_CLOSED,
|
|
3570
3659
|
message: 'Bundle is already closed, no more calls to "generate" or "write" are allowed.'
|
|
3571
3660
|
};
|
|
3572
3661
|
}
|
|
3573
|
-
function
|
|
3662
|
+
function logAmbiguousExternalNamespaces(binding, reexportingModule, usedModule, sources) {
|
|
3574
3663
|
return {
|
|
3575
3664
|
binding,
|
|
3576
3665
|
code: AMBIGUOUS_EXTERNAL_NAMESPACES,
|
|
@@ -3579,61 +3668,61 @@ function errorAmbiguousExternalNamespaces(binding, reexportingModule, usedModule
|
|
|
3579
3668
|
reexporter: reexportingModule
|
|
3580
3669
|
};
|
|
3581
3670
|
}
|
|
3582
|
-
function
|
|
3671
|
+
function logAnonymousPluginCache() {
|
|
3583
3672
|
return {
|
|
3584
3673
|
code: ANONYMOUS_PLUGIN_CACHE,
|
|
3585
3674
|
message: 'A plugin is trying to use the Rollup cache but is not declaring a plugin name or cacheKey.'
|
|
3586
3675
|
};
|
|
3587
3676
|
}
|
|
3588
|
-
function
|
|
3677
|
+
function logAssetNotFinalisedForFileName(name) {
|
|
3589
3678
|
return {
|
|
3590
3679
|
code: ASSET_NOT_FINALISED,
|
|
3591
3680
|
message: `Plugin error - Unable to get file name for asset "${name}". Ensure that the source is set and that generate is called first. If you reference assets via import.meta.ROLLUP_FILE_URL_<referenceId>, you need to either have set their source after "renderStart" or need to provide an explicit "fileName" when emitting them.`
|
|
3592
3681
|
};
|
|
3593
3682
|
}
|
|
3594
|
-
function
|
|
3683
|
+
function logAssetReferenceIdNotFoundForSetSource(assetReferenceId) {
|
|
3595
3684
|
return {
|
|
3596
3685
|
code: ASSET_NOT_FOUND,
|
|
3597
3686
|
message: `Plugin error - Unable to set the source for unknown asset "${assetReferenceId}".`
|
|
3598
3687
|
};
|
|
3599
3688
|
}
|
|
3600
|
-
function
|
|
3689
|
+
function logAssetSourceAlreadySet(name) {
|
|
3601
3690
|
return {
|
|
3602
3691
|
code: ASSET_SOURCE_ALREADY_SET,
|
|
3603
3692
|
message: `Unable to set the source for asset "${name}", source already set.`
|
|
3604
3693
|
};
|
|
3605
3694
|
}
|
|
3606
|
-
function
|
|
3695
|
+
function logNoAssetSourceSet(assetName) {
|
|
3607
3696
|
return {
|
|
3608
3697
|
code: ASSET_SOURCE_MISSING,
|
|
3609
3698
|
message: `Plugin error creating asset "${assetName}" - no asset source set.`
|
|
3610
3699
|
};
|
|
3611
3700
|
}
|
|
3612
|
-
function
|
|
3701
|
+
function logBadLoader(id) {
|
|
3613
3702
|
return {
|
|
3614
3703
|
code: BAD_LOADER,
|
|
3615
3704
|
message: `Error loading "${relativeId(id)}": plugin load hook should return a string, a { code, map } object, or nothing/null.`
|
|
3616
3705
|
};
|
|
3617
3706
|
}
|
|
3618
|
-
function
|
|
3707
|
+
function logCannotCallNamespace(name) {
|
|
3619
3708
|
return {
|
|
3620
3709
|
code: CANNOT_CALL_NAMESPACE,
|
|
3621
3710
|
message: `Cannot call a namespace ("${name}").`
|
|
3622
3711
|
};
|
|
3623
3712
|
}
|
|
3624
|
-
function
|
|
3713
|
+
function logCannotEmitFromOptionsHook() {
|
|
3625
3714
|
return {
|
|
3626
3715
|
code: CANNOT_EMIT_FROM_OPTIONS_HOOK,
|
|
3627
3716
|
message: `Cannot emit files or set asset sources in the "outputOptions" hook, use the "renderStart" hook instead.`
|
|
3628
3717
|
};
|
|
3629
3718
|
}
|
|
3630
|
-
function
|
|
3719
|
+
function logChunkNotGeneratedForFileName(name) {
|
|
3631
3720
|
return {
|
|
3632
3721
|
code: CHUNK_NOT_GENERATED,
|
|
3633
3722
|
message: `Plugin error - Unable to get file name for emitted chunk "${name}". You can only get file names once chunks have been generated after the "renderStart" hook.`
|
|
3634
3723
|
};
|
|
3635
3724
|
}
|
|
3636
|
-
function
|
|
3725
|
+
function logChunkInvalid({ fileName, code }, exception) {
|
|
3637
3726
|
const errorProperties = {
|
|
3638
3727
|
code: CHUNK_INVALID,
|
|
3639
3728
|
message: `Chunk "${fileName}" is not valid JavaScript: ${exception.message}.`
|
|
@@ -3641,21 +3730,21 @@ function errorChunkInvalid({ fileName, code }, exception) {
|
|
|
3641
3730
|
augmentCodeLocation(errorProperties, exception.loc, code, fileName);
|
|
3642
3731
|
return errorProperties;
|
|
3643
3732
|
}
|
|
3644
|
-
function
|
|
3733
|
+
function logCircularDependency(cyclePath) {
|
|
3645
3734
|
return {
|
|
3646
3735
|
code: CIRCULAR_DEPENDENCY,
|
|
3647
3736
|
ids: cyclePath,
|
|
3648
3737
|
message: `Circular dependency: ${cyclePath.map(relativeId).join(' -> ')}`
|
|
3649
3738
|
};
|
|
3650
3739
|
}
|
|
3651
|
-
function
|
|
3740
|
+
function logCircularReexport(exportName, exporter) {
|
|
3652
3741
|
return {
|
|
3653
3742
|
code: CIRCULAR_REEXPORT,
|
|
3654
3743
|
exporter,
|
|
3655
3744
|
message: `"${exportName}" cannot be exported from "${relativeId(exporter)}" as it is a reexport that references itself.`
|
|
3656
3745
|
};
|
|
3657
3746
|
}
|
|
3658
|
-
function
|
|
3747
|
+
function logCyclicCrossChunkReexport(exportName, exporter, reexporter, importer, preserveModules) {
|
|
3659
3748
|
return {
|
|
3660
3749
|
code: CYCLIC_CROSS_CHUNK_REEXPORT,
|
|
3661
3750
|
exporter,
|
|
@@ -3664,7 +3753,7 @@ function errorCyclicCrossChunkReexport(exportName, exporter, reexporter, importe
|
|
|
3664
3753
|
reexporter
|
|
3665
3754
|
};
|
|
3666
3755
|
}
|
|
3667
|
-
function
|
|
3756
|
+
function logDeprecation(deprecation, urlSnippet, plugin) {
|
|
3668
3757
|
return {
|
|
3669
3758
|
code: DEPRECATED_FEATURE,
|
|
3670
3759
|
message: deprecation,
|
|
@@ -3672,20 +3761,20 @@ function errorDeprecation(deprecation, urlSnippet, plugin) {
|
|
|
3672
3761
|
...(plugin ? { plugin } : {})
|
|
3673
3762
|
};
|
|
3674
3763
|
}
|
|
3675
|
-
function
|
|
3764
|
+
function logDuplicatePluginName(plugin) {
|
|
3676
3765
|
return {
|
|
3677
3766
|
code: DUPLICATE_PLUGIN_NAME,
|
|
3678
3767
|
message: `The plugin name ${plugin} is being used twice in the same build. Plugin names must be distinct or provide a cacheKey (please post an issue to the plugin if you are a plugin user).`
|
|
3679
3768
|
};
|
|
3680
3769
|
}
|
|
3681
|
-
function
|
|
3770
|
+
function logEmptyChunk(chunkName) {
|
|
3682
3771
|
return {
|
|
3683
3772
|
code: EMPTY_BUNDLE,
|
|
3684
3773
|
message: `Generated an empty chunk: "${chunkName}".`,
|
|
3685
3774
|
names: [chunkName]
|
|
3686
3775
|
};
|
|
3687
3776
|
}
|
|
3688
|
-
function
|
|
3777
|
+
function logEval(id) {
|
|
3689
3778
|
return {
|
|
3690
3779
|
code: EVAL,
|
|
3691
3780
|
id,
|
|
@@ -3693,39 +3782,45 @@ function errorEval(id) {
|
|
|
3693
3782
|
url: getRollupUrl(URL_AVOIDING_EVAL)
|
|
3694
3783
|
};
|
|
3695
3784
|
}
|
|
3696
|
-
function
|
|
3785
|
+
function logExternalSyntheticExports(id, importer) {
|
|
3697
3786
|
return {
|
|
3698
3787
|
code: EXTERNAL_SYNTHETIC_EXPORTS,
|
|
3699
3788
|
exporter: id,
|
|
3700
3789
|
message: `External "${id}" cannot have "syntheticNamedExports" enabled (imported by "${relativeId(importer)}").`
|
|
3701
3790
|
};
|
|
3702
3791
|
}
|
|
3703
|
-
function
|
|
3792
|
+
function logFileNameConflict(fileName) {
|
|
3704
3793
|
return {
|
|
3705
3794
|
code: FILE_NAME_CONFLICT,
|
|
3706
3795
|
message: `The emitted file "${fileName}" overwrites a previously emitted file of the same name.`
|
|
3707
3796
|
};
|
|
3708
3797
|
}
|
|
3709
|
-
function
|
|
3798
|
+
function logFileReferenceIdNotFoundForFilename(assetReferenceId) {
|
|
3710
3799
|
return {
|
|
3711
3800
|
code: FILE_NOT_FOUND,
|
|
3712
3801
|
message: `Plugin error - Unable to get file name for unknown file "${assetReferenceId}".`
|
|
3713
3802
|
};
|
|
3714
3803
|
}
|
|
3715
|
-
function
|
|
3804
|
+
function logFirstSideEffect(source, id, { line, column }) {
|
|
3805
|
+
return {
|
|
3806
|
+
code: FIRST_SIDE_EFFECT,
|
|
3807
|
+
message: `First side effect in ${relativeId(id)} is at (${line}:${column})\n${getCodeFrame(source, line, column)}`
|
|
3808
|
+
};
|
|
3809
|
+
}
|
|
3810
|
+
function logIllegalIdentifierAsName(name) {
|
|
3716
3811
|
return {
|
|
3717
3812
|
code: ILLEGAL_IDENTIFIER_AS_NAME,
|
|
3718
3813
|
message: `Given name "${name}" is not a legal JS identifier. If you need this, you can try "output.extend: true".`,
|
|
3719
3814
|
url: getRollupUrl(URL_OUTPUT_EXTEND)
|
|
3720
3815
|
};
|
|
3721
3816
|
}
|
|
3722
|
-
function
|
|
3817
|
+
function logIllegalImportReassignment(name, importingId) {
|
|
3723
3818
|
return {
|
|
3724
3819
|
code: ILLEGAL_REASSIGNMENT,
|
|
3725
3820
|
message: `Illegal reassignment of import "${name}" in "${relativeId(importingId)}".`
|
|
3726
3821
|
};
|
|
3727
3822
|
}
|
|
3728
|
-
function
|
|
3823
|
+
function logInconsistentImportAssertions(existingAssertions, newAssertions, source, importer) {
|
|
3729
3824
|
return {
|
|
3730
3825
|
code: INCONSISTENT_IMPORT_ASSERTIONS,
|
|
3731
3826
|
message: `Module "${relativeId(importer)}" tried to import "${relativeId(source)}" with ${formatAssertions(newAssertions)} assertions, but it was already imported elsewhere with ${formatAssertions(existingAssertions)} assertions. Please ensure that import assertions for the same module are always consistent.`
|
|
@@ -3737,46 +3832,52 @@ const formatAssertions = (assertions) => {
|
|
|
3737
3832
|
return 'no';
|
|
3738
3833
|
return entries.map(([key, value]) => `"${key}": "${value}"`).join(', ');
|
|
3739
3834
|
};
|
|
3740
|
-
function
|
|
3835
|
+
function logInputHookInOutputPlugin(pluginName, hookName) {
|
|
3741
3836
|
return {
|
|
3742
3837
|
code: INPUT_HOOK_IN_OUTPUT_PLUGIN,
|
|
3743
3838
|
message: `The "${hookName}" hook used by the output plugin ${pluginName} is a build time hook and will not be run for that plugin. Either this plugin cannot be used as an output plugin, or it should have an option to configure it as an output plugin.`
|
|
3744
3839
|
};
|
|
3745
3840
|
}
|
|
3746
|
-
function
|
|
3841
|
+
function logCannotAssignModuleToChunk(moduleId, assignToAlias, currentAlias) {
|
|
3747
3842
|
return {
|
|
3748
3843
|
code: INVALID_CHUNK,
|
|
3749
3844
|
message: `Cannot assign "${relativeId(moduleId)}" to the "${assignToAlias}" chunk as it is already in the "${currentAlias}" chunk.`
|
|
3750
3845
|
};
|
|
3751
3846
|
}
|
|
3752
|
-
function
|
|
3847
|
+
function logInvalidExportOptionValue(optionValue) {
|
|
3753
3848
|
return {
|
|
3754
3849
|
code: INVALID_EXPORT_OPTION,
|
|
3755
3850
|
message: `"output.exports" must be "default", "named", "none", "auto", or left unspecified (defaults to "auto"), received "${optionValue}".`,
|
|
3756
3851
|
url: getRollupUrl(URL_OUTPUT_EXPORTS)
|
|
3757
3852
|
};
|
|
3758
3853
|
}
|
|
3759
|
-
function
|
|
3854
|
+
function logIncompatibleExportOptionValue(optionValue, keys, entryModule) {
|
|
3760
3855
|
return {
|
|
3761
3856
|
code: INVALID_EXPORT_OPTION,
|
|
3762
3857
|
message: `"${optionValue}" was specified for "output.exports", but entry module "${relativeId(entryModule)}" has the following exports: ${printQuotedStringList(keys)}`,
|
|
3763
3858
|
url: getRollupUrl(URL_OUTPUT_EXPORTS)
|
|
3764
3859
|
};
|
|
3765
3860
|
}
|
|
3766
|
-
function
|
|
3861
|
+
function logInternalIdCannotBeExternal(source, importer) {
|
|
3767
3862
|
return {
|
|
3768
3863
|
code: INVALID_EXTERNAL_ID,
|
|
3769
3864
|
message: `"${source}" is imported as an external by "${relativeId(importer)}", but is already an existing non-external module id.`
|
|
3770
3865
|
};
|
|
3771
3866
|
}
|
|
3772
|
-
function
|
|
3867
|
+
function logInvalidLogPosition(plugin) {
|
|
3868
|
+
return {
|
|
3869
|
+
code: INVALID_LOG_POSITION,
|
|
3870
|
+
message: `Plugin "${plugin}" tried to add a file position to a log or warning. This is only supported in the "transform" hook at the moment and will be ignored.`
|
|
3871
|
+
};
|
|
3872
|
+
}
|
|
3873
|
+
function logInvalidOption(option, urlSnippet, explanation, value) {
|
|
3773
3874
|
return {
|
|
3774
3875
|
code: INVALID_OPTION,
|
|
3775
3876
|
message: `Invalid value ${value === undefined ? '' : `${JSON.stringify(value)} `}for option "${option}" - ${explanation}.`,
|
|
3776
3877
|
url: getRollupUrl(urlSnippet)
|
|
3777
3878
|
};
|
|
3778
3879
|
}
|
|
3779
|
-
function
|
|
3880
|
+
function logInvalidAddonPluginHook(hook, plugin) {
|
|
3780
3881
|
return {
|
|
3781
3882
|
code: INVALID_PLUGIN_HOOK,
|
|
3782
3883
|
hook,
|
|
@@ -3784,7 +3885,7 @@ function errorInvalidAddonPluginHook(hook, plugin) {
|
|
|
3784
3885
|
plugin
|
|
3785
3886
|
};
|
|
3786
3887
|
}
|
|
3787
|
-
function
|
|
3888
|
+
function logInvalidFunctionPluginHook(hook, plugin) {
|
|
3788
3889
|
return {
|
|
3789
3890
|
code: INVALID_PLUGIN_HOOK,
|
|
3790
3891
|
hook,
|
|
@@ -3792,32 +3893,32 @@ function errorInvalidFunctionPluginHook(hook, plugin) {
|
|
|
3792
3893
|
plugin
|
|
3793
3894
|
};
|
|
3794
3895
|
}
|
|
3795
|
-
function
|
|
3896
|
+
function logInvalidRollupPhaseForAddWatchFile() {
|
|
3796
3897
|
return {
|
|
3797
3898
|
code: INVALID_ROLLUP_PHASE,
|
|
3798
3899
|
message: `Cannot call "addWatchFile" after the build has finished.`
|
|
3799
3900
|
};
|
|
3800
3901
|
}
|
|
3801
|
-
function
|
|
3902
|
+
function logInvalidRollupPhaseForChunkEmission() {
|
|
3802
3903
|
return {
|
|
3803
3904
|
code: INVALID_ROLLUP_PHASE,
|
|
3804
3905
|
message: `Cannot emit chunks after module loading has finished.`
|
|
3805
3906
|
};
|
|
3806
3907
|
}
|
|
3807
|
-
function
|
|
3908
|
+
function logInvalidSetAssetSourceCall() {
|
|
3808
3909
|
return {
|
|
3809
3910
|
code: INVALID_SETASSETSOURCE,
|
|
3810
3911
|
message: `setAssetSource cannot be called in transform for caching reasons. Use emitFile with a source, or call setAssetSource in another hook.`
|
|
3811
3912
|
};
|
|
3812
3913
|
}
|
|
3813
|
-
function
|
|
3914
|
+
function logInvalidFormatForTopLevelAwait(id, format) {
|
|
3814
3915
|
return {
|
|
3815
3916
|
code: INVALID_TLA_FORMAT,
|
|
3816
3917
|
id,
|
|
3817
3918
|
message: `Module format "${format}" does not support top-level await. Use the "es" or "system" output formats rather.`
|
|
3818
3919
|
};
|
|
3819
3920
|
}
|
|
3820
|
-
function
|
|
3921
|
+
function logMissingExport(binding, importingModule, exporter) {
|
|
3821
3922
|
const isJson = extname(exporter) === '.json';
|
|
3822
3923
|
return {
|
|
3823
3924
|
binding,
|
|
@@ -3828,7 +3929,7 @@ function errorMissingExport(binding, importingModule, exporter) {
|
|
|
3828
3929
|
url: getRollupUrl(URL_NAME_IS_NOT_EXPORTED)
|
|
3829
3930
|
};
|
|
3830
3931
|
}
|
|
3831
|
-
function
|
|
3932
|
+
function logMissingGlobalName(externalId, guess) {
|
|
3832
3933
|
return {
|
|
3833
3934
|
code: MISSING_GLOBAL_NAME,
|
|
3834
3935
|
id: externalId,
|
|
@@ -3837,19 +3938,19 @@ function errorMissingGlobalName(externalId, guess) {
|
|
|
3837
3938
|
url: getRollupUrl(URL_OUTPUT_GLOBALS)
|
|
3838
3939
|
};
|
|
3839
3940
|
}
|
|
3840
|
-
function
|
|
3941
|
+
function logImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore) {
|
|
3841
3942
|
return {
|
|
3842
3943
|
code: MISSING_IMPLICIT_DEPENDANT,
|
|
3843
3944
|
message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" cannot be external.`
|
|
3844
3945
|
};
|
|
3845
3946
|
}
|
|
3846
|
-
function
|
|
3947
|
+
function logUnresolvedImplicitDependant(unresolvedId, implicitlyLoadedBefore) {
|
|
3847
3948
|
return {
|
|
3848
3949
|
code: MISSING_IMPLICIT_DEPENDANT,
|
|
3849
3950
|
message: `Module "${relativeId(unresolvedId)}" that should be implicitly loaded before "${relativeId(implicitlyLoadedBefore)}" could not be resolved.`
|
|
3850
3951
|
};
|
|
3851
3952
|
}
|
|
3852
|
-
function
|
|
3953
|
+
function logImplicitDependantIsNotIncluded(module) {
|
|
3853
3954
|
const implicitDependencies = [...module.implicitlyLoadedBefore]
|
|
3854
3955
|
.map(dependency => relativeId(dependency.id))
|
|
3855
3956
|
.sort();
|
|
@@ -3858,21 +3959,21 @@ function errorImplicitDependantIsNotIncluded(module) {
|
|
|
3858
3959
|
message: `Module "${relativeId(module.id)}" that should be implicitly loaded before ${printQuotedStringList(implicitDependencies)} is not included in the module graph. Either it was not imported by an included module or only via a tree-shaken dynamic import, or no imported bindings were used and it had otherwise no side-effects.`
|
|
3859
3960
|
};
|
|
3860
3961
|
}
|
|
3861
|
-
function
|
|
3962
|
+
function logMissingNameOptionForIifeExport() {
|
|
3862
3963
|
return {
|
|
3863
3964
|
code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
|
|
3864
3965
|
message: `If you do not supply "output.name", you may not be able to access the exports of an IIFE bundle.`,
|
|
3865
3966
|
url: getRollupUrl(URL_OUTPUT_NAME)
|
|
3866
3967
|
};
|
|
3867
3968
|
}
|
|
3868
|
-
function
|
|
3969
|
+
function logMissingNameOptionForUmdExport() {
|
|
3869
3970
|
return {
|
|
3870
3971
|
code: MISSING_NAME_OPTION_FOR_IIFE_EXPORT,
|
|
3871
3972
|
message: 'You must supply "output.name" for UMD bundles that have exports so that the exports are accessible in environments without a module loader.',
|
|
3872
3973
|
url: getRollupUrl(URL_OUTPUT_NAME)
|
|
3873
3974
|
};
|
|
3874
3975
|
}
|
|
3875
|
-
function
|
|
3976
|
+
function logMissingNodeBuiltins(externalBuiltins) {
|
|
3876
3977
|
return {
|
|
3877
3978
|
code: MISSING_NODE_BUILTINS,
|
|
3878
3979
|
ids: externalBuiltins,
|
|
@@ -3880,14 +3981,14 @@ function errorMissingNodeBuiltins(externalBuiltins) {
|
|
|
3880
3981
|
};
|
|
3881
3982
|
}
|
|
3882
3983
|
// eslint-disable-next-line unicorn/prevent-abbreviations
|
|
3883
|
-
function
|
|
3984
|
+
function logMissingFileOrDirOption() {
|
|
3884
3985
|
return {
|
|
3885
3986
|
code: MISSING_OPTION,
|
|
3886
3987
|
message: 'You must specify "output.file" or "output.dir" for the build.',
|
|
3887
3988
|
url: getRollupUrl(URL_OUTPUT_DIR)
|
|
3888
3989
|
};
|
|
3889
3990
|
}
|
|
3890
|
-
function
|
|
3991
|
+
function logMixedExport(facadeModuleId, name) {
|
|
3891
3992
|
return {
|
|
3892
3993
|
code: MIXED_EXPORTS,
|
|
3893
3994
|
id: facadeModuleId,
|
|
@@ -3895,14 +3996,14 @@ function errorMixedExport(facadeModuleId, name) {
|
|
|
3895
3996
|
url: getRollupUrl(URL_OUTPUT_EXPORTS)
|
|
3896
3997
|
};
|
|
3897
3998
|
}
|
|
3898
|
-
function
|
|
3999
|
+
function logModuleLevelDirective(directive, id) {
|
|
3899
4000
|
return {
|
|
3900
4001
|
code: MODULE_LEVEL_DIRECTIVE,
|
|
3901
4002
|
id,
|
|
3902
4003
|
message: `Module level directives cause errors when bundled, "${directive}" in "${relativeId(id)}" was ignored.`
|
|
3903
4004
|
};
|
|
3904
4005
|
}
|
|
3905
|
-
function
|
|
4006
|
+
function logNamespaceConflict(binding, reexportingModuleId, sources) {
|
|
3906
4007
|
return {
|
|
3907
4008
|
binding,
|
|
3908
4009
|
code: NAMESPACE_CONFLICT,
|
|
@@ -3911,14 +4012,22 @@ function errorNamespaceConflict(binding, reexportingModuleId, sources) {
|
|
|
3911
4012
|
reexporter: reexportingModuleId
|
|
3912
4013
|
};
|
|
3913
4014
|
}
|
|
3914
|
-
function
|
|
4015
|
+
function logNoTransformMapOrAstWithoutCode(pluginName) {
|
|
3915
4016
|
return {
|
|
3916
4017
|
code: NO_TRANSFORM_MAP_OR_AST_WITHOUT_CODE,
|
|
3917
4018
|
message: `The plugin "${pluginName}" returned a "map" or "ast" without returning ` +
|
|
3918
4019
|
'a "code". This will be ignored.'
|
|
3919
4020
|
};
|
|
3920
4021
|
}
|
|
3921
|
-
function
|
|
4022
|
+
function logOptimizeChunkStatus(chunks, smallChunks, pointInTime) {
|
|
4023
|
+
return {
|
|
4024
|
+
code: OPTIMIZE_CHUNK_STATUS,
|
|
4025
|
+
message: `${pointInTime}, there are\n` +
|
|
4026
|
+
`${chunks} chunks, of which\n` +
|
|
4027
|
+
`${smallChunks} are below minChunkSize.`
|
|
4028
|
+
};
|
|
4029
|
+
}
|
|
4030
|
+
function logParseError(error, moduleId) {
|
|
3922
4031
|
let message = error.message.replace(/ \(\d+:\d+\)$/, '');
|
|
3923
4032
|
if (moduleId.endsWith('.json')) {
|
|
3924
4033
|
message += ' (Note that you need @rollup/plugin-json to import JSON files)';
|
|
@@ -3933,10 +4042,8 @@ function errorParseError(error, moduleId) {
|
|
|
3933
4042
|
message
|
|
3934
4043
|
};
|
|
3935
4044
|
}
|
|
3936
|
-
function
|
|
3937
|
-
if (
|
|
3938
|
-
error = { message: error };
|
|
3939
|
-
if (error.code && error.code !== PLUGIN_ERROR) {
|
|
4045
|
+
function logPluginError(error, plugin, { hook, id } = {}) {
|
|
4046
|
+
if (error.code && !error.code.startsWith('PLUGIN_') && !error.pluginCode) {
|
|
3940
4047
|
error.pluginCode = error.code;
|
|
3941
4048
|
}
|
|
3942
4049
|
error.code = PLUGIN_ERROR;
|
|
@@ -3949,7 +4056,7 @@ function errorPluginError(error, plugin, { hook, id } = {}) {
|
|
|
3949
4056
|
}
|
|
3950
4057
|
return error;
|
|
3951
4058
|
}
|
|
3952
|
-
function
|
|
4059
|
+
function logShimmedExport(id, binding) {
|
|
3953
4060
|
return {
|
|
3954
4061
|
binding,
|
|
3955
4062
|
code: SHIMMED_EXPORT,
|
|
@@ -3957,7 +4064,7 @@ function errorShimmedExport(id, binding) {
|
|
|
3957
4064
|
message: `Missing export "${binding}" has been shimmed in module "${relativeId(id)}".`
|
|
3958
4065
|
};
|
|
3959
4066
|
}
|
|
3960
|
-
function
|
|
4067
|
+
function logSourcemapBroken(plugin) {
|
|
3961
4068
|
return {
|
|
3962
4069
|
code: SOURCEMAP_BROKEN,
|
|
3963
4070
|
message: `Sourcemap is likely to be incorrect: a plugin (${plugin}) was used to transform files, but didn't generate a sourcemap for the transformation. Consult the plugin documentation for help`,
|
|
@@ -3965,13 +4072,13 @@ function errorSourcemapBroken(plugin) {
|
|
|
3965
4072
|
url: getRollupUrl(URL_SOURCEMAP_IS_LIKELY_TO_BE_INCORRECT)
|
|
3966
4073
|
};
|
|
3967
4074
|
}
|
|
3968
|
-
function
|
|
4075
|
+
function logConflictingSourcemapSources(filename) {
|
|
3969
4076
|
return {
|
|
3970
4077
|
code: SOURCEMAP_BROKEN,
|
|
3971
4078
|
message: `Multiple conflicting contents for sourcemap source ${filename}`
|
|
3972
4079
|
};
|
|
3973
4080
|
}
|
|
3974
|
-
function
|
|
4081
|
+
function logInvalidSourcemapForError(error, id, column, line, pos) {
|
|
3975
4082
|
return {
|
|
3976
4083
|
cause: error,
|
|
3977
4084
|
code: SOURCEMAP_ERROR,
|
|
@@ -3985,7 +4092,7 @@ function errorInvalidSourcemapForError(error, id, column, line, pos) {
|
|
|
3985
4092
|
pos
|
|
3986
4093
|
};
|
|
3987
4094
|
}
|
|
3988
|
-
function
|
|
4095
|
+
function logSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExportsOption) {
|
|
3989
4096
|
return {
|
|
3990
4097
|
code: SYNTHETIC_NAMED_EXPORTS_NEED_NAMESPACE_EXPORT,
|
|
3991
4098
|
exporter: id,
|
|
@@ -3994,14 +4101,14 @@ function errorSyntheticNamedExportsNeedNamespaceExport(id, syntheticNamedExports
|
|
|
3994
4101
|
: 'a default export'} that does not reexport an unresolved named export of the same module.`
|
|
3995
4102
|
};
|
|
3996
4103
|
}
|
|
3997
|
-
function
|
|
4104
|
+
function logThisIsUndefined() {
|
|
3998
4105
|
return {
|
|
3999
4106
|
code: THIS_IS_UNDEFINED,
|
|
4000
4107
|
message: `The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten`,
|
|
4001
4108
|
url: getRollupUrl(URL_THIS_IS_UNDEFINED)
|
|
4002
4109
|
};
|
|
4003
4110
|
}
|
|
4004
|
-
function
|
|
4111
|
+
function logUnexpectedNamedImport(id, imported, isReexport) {
|
|
4005
4112
|
const importType = isReexport ? 'reexport' : 'import';
|
|
4006
4113
|
return {
|
|
4007
4114
|
code: UNEXPECTED_NAMED_IMPORT,
|
|
@@ -4010,7 +4117,7 @@ function errorUnexpectedNamedImport(id, imported, isReexport) {
|
|
|
4010
4117
|
url: getRollupUrl(URL_OUTPUT_INTEROP)
|
|
4011
4118
|
};
|
|
4012
4119
|
}
|
|
4013
|
-
function
|
|
4120
|
+
function logUnexpectedNamespaceReexport(id) {
|
|
4014
4121
|
return {
|
|
4015
4122
|
code: UNEXPECTED_NAMED_IMPORT,
|
|
4016
4123
|
exporter: id,
|
|
@@ -4018,25 +4125,25 @@ function errorUnexpectedNamespaceReexport(id) {
|
|
|
4018
4125
|
url: getRollupUrl(URL_OUTPUT_INTEROP)
|
|
4019
4126
|
};
|
|
4020
4127
|
}
|
|
4021
|
-
function
|
|
4128
|
+
function logUnknownOption(optionType, unknownOptions, validOptions) {
|
|
4022
4129
|
return {
|
|
4023
4130
|
code: UNKNOWN_OPTION,
|
|
4024
4131
|
message: `Unknown ${optionType}: ${unknownOptions.join(', ')}. Allowed options: ${validOptions.join(', ')}`
|
|
4025
4132
|
};
|
|
4026
4133
|
}
|
|
4027
|
-
function
|
|
4134
|
+
function logEntryCannotBeExternal(unresolvedId) {
|
|
4028
4135
|
return {
|
|
4029
4136
|
code: UNRESOLVED_ENTRY,
|
|
4030
4137
|
message: `Entry module "${relativeId(unresolvedId)}" cannot be external.`
|
|
4031
4138
|
};
|
|
4032
4139
|
}
|
|
4033
|
-
function
|
|
4140
|
+
function logUnresolvedEntry(unresolvedId) {
|
|
4034
4141
|
return {
|
|
4035
4142
|
code: UNRESOLVED_ENTRY,
|
|
4036
4143
|
message: `Could not resolve entry module "${relativeId(unresolvedId)}".`
|
|
4037
4144
|
};
|
|
4038
4145
|
}
|
|
4039
|
-
function
|
|
4146
|
+
function logUnresolvedImport(source, importer) {
|
|
4040
4147
|
return {
|
|
4041
4148
|
code: UNRESOLVED_IMPORT,
|
|
4042
4149
|
exporter: source,
|
|
@@ -4044,7 +4151,7 @@ function errorUnresolvedImport(source, importer) {
|
|
|
4044
4151
|
message: `Could not resolve "${source}" from "${relativeId(importer)}"`
|
|
4045
4152
|
};
|
|
4046
4153
|
}
|
|
4047
|
-
function
|
|
4154
|
+
function logUnresolvedImportTreatedAsExternal(source, importer) {
|
|
4048
4155
|
return {
|
|
4049
4156
|
code: UNRESOLVED_IMPORT,
|
|
4050
4157
|
exporter: source,
|
|
@@ -4053,7 +4160,7 @@ function errorUnresolvedImportTreatedAsExternal(source, importer) {
|
|
|
4053
4160
|
url: getRollupUrl(URL_TREATING_MODULE_AS_EXTERNAL_DEPENDENCY)
|
|
4054
4161
|
};
|
|
4055
4162
|
}
|
|
4056
|
-
function
|
|
4163
|
+
function logUnusedExternalImports(externalId, names, importers) {
|
|
4057
4164
|
return {
|
|
4058
4165
|
code: UNUSED_EXTERNAL_IMPORT,
|
|
4059
4166
|
exporter: externalId,
|
|
@@ -4065,94 +4172,23 @@ function errorUnusedExternalImports(externalId, names, importers) {
|
|
|
4065
4172
|
names
|
|
4066
4173
|
};
|
|
4067
4174
|
}
|
|
4068
|
-
function
|
|
4175
|
+
function logFailedValidation(message) {
|
|
4069
4176
|
return {
|
|
4070
4177
|
code: VALIDATION_ERROR,
|
|
4071
4178
|
message
|
|
4072
4179
|
};
|
|
4073
4180
|
}
|
|
4074
4181
|
function warnDeprecation(deprecation, urlSnippet, activeDeprecation, options, plugin) {
|
|
4075
|
-
warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.
|
|
4182
|
+
warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, options.onLog, options.strictDeprecations, plugin);
|
|
4076
4183
|
}
|
|
4077
|
-
function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation,
|
|
4184
|
+
function warnDeprecationWithOptions(deprecation, urlSnippet, activeDeprecation, log, strictDeprecations, plugin) {
|
|
4078
4185
|
if (activeDeprecation || strictDeprecations) {
|
|
4079
|
-
const warning =
|
|
4186
|
+
const warning = logDeprecation(deprecation, urlSnippet, plugin);
|
|
4080
4187
|
if (strictDeprecations) {
|
|
4081
4188
|
return error(warning);
|
|
4082
4189
|
}
|
|
4083
|
-
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
|
|
4087
|
-
const RESERVED_NAMES = new Set([
|
|
4088
|
-
'await',
|
|
4089
|
-
'break',
|
|
4090
|
-
'case',
|
|
4091
|
-
'catch',
|
|
4092
|
-
'class',
|
|
4093
|
-
'const',
|
|
4094
|
-
'continue',
|
|
4095
|
-
'debugger',
|
|
4096
|
-
'default',
|
|
4097
|
-
'delete',
|
|
4098
|
-
'do',
|
|
4099
|
-
'else',
|
|
4100
|
-
'enum',
|
|
4101
|
-
'eval',
|
|
4102
|
-
'export',
|
|
4103
|
-
'extends',
|
|
4104
|
-
'false',
|
|
4105
|
-
'finally',
|
|
4106
|
-
'for',
|
|
4107
|
-
'function',
|
|
4108
|
-
'if',
|
|
4109
|
-
'implements',
|
|
4110
|
-
'import',
|
|
4111
|
-
'in',
|
|
4112
|
-
'instanceof',
|
|
4113
|
-
'interface',
|
|
4114
|
-
'let',
|
|
4115
|
-
'NaN',
|
|
4116
|
-
'new',
|
|
4117
|
-
'null',
|
|
4118
|
-
'package',
|
|
4119
|
-
'private',
|
|
4120
|
-
'protected',
|
|
4121
|
-
'public',
|
|
4122
|
-
'return',
|
|
4123
|
-
'static',
|
|
4124
|
-
'super',
|
|
4125
|
-
'switch',
|
|
4126
|
-
'this',
|
|
4127
|
-
'throw',
|
|
4128
|
-
'true',
|
|
4129
|
-
'try',
|
|
4130
|
-
'typeof',
|
|
4131
|
-
'undefined',
|
|
4132
|
-
'var',
|
|
4133
|
-
'void',
|
|
4134
|
-
'while',
|
|
4135
|
-
'with',
|
|
4136
|
-
'yield'
|
|
4137
|
-
]);
|
|
4138
|
-
const RESERVED_NAMES$1 = RESERVED_NAMES;
|
|
4139
|
-
|
|
4140
|
-
const illegalCharacters = /[^\w$]/g;
|
|
4141
|
-
const startsWithDigit = (value) => /\d/.test(value[0]);
|
|
4142
|
-
const needsEscape = (value) => startsWithDigit(value) || RESERVED_NAMES$1.has(value) || value === 'arguments';
|
|
4143
|
-
function isLegal(value) {
|
|
4144
|
-
if (needsEscape(value)) {
|
|
4145
|
-
return false;
|
|
4190
|
+
log(LOGLEVEL_WARN, warning);
|
|
4146
4191
|
}
|
|
4147
|
-
return !illegalCharacters.test(value);
|
|
4148
|
-
}
|
|
4149
|
-
function makeLegal(value) {
|
|
4150
|
-
value = value
|
|
4151
|
-
.replace(/-(\w)/g, (_, letter) => letter.toUpperCase())
|
|
4152
|
-
.replace(illegalCharacters, '_');
|
|
4153
|
-
if (needsEscape(value))
|
|
4154
|
-
value = `_${value}`;
|
|
4155
|
-
return value || '_';
|
|
4156
4192
|
}
|
|
4157
4193
|
|
|
4158
4194
|
class ExternalModule {
|
|
@@ -4237,7 +4273,7 @@ class ExternalModule {
|
|
|
4237
4273
|
}
|
|
4238
4274
|
}
|
|
4239
4275
|
const importersArray = [...importersSet];
|
|
4240
|
-
this.options.
|
|
4276
|
+
this.options.onLog(LOGLEVEL_WARN, logUnusedExternalImports(this.id, unused, importersArray));
|
|
4241
4277
|
}
|
|
4242
4278
|
}
|
|
4243
4279
|
|
|
@@ -5035,7 +5071,10 @@ const BlockStatement$1 = 'BlockStatement';
|
|
|
5035
5071
|
const CallExpression$1 = 'CallExpression';
|
|
5036
5072
|
const ChainExpression$1 = 'ChainExpression';
|
|
5037
5073
|
const ConditionalExpression$1 = 'ConditionalExpression';
|
|
5074
|
+
const ExportDefaultDeclaration$1 = 'ExportDefaultDeclaration';
|
|
5075
|
+
const ExportNamedDeclaration$1 = 'ExportNamedDeclaration';
|
|
5038
5076
|
const ExpressionStatement$1 = 'ExpressionStatement';
|
|
5077
|
+
const FunctionDeclaration$1 = 'FunctionDeclaration';
|
|
5039
5078
|
const Identifier$1 = 'Identifier';
|
|
5040
5079
|
const LogicalExpression$1 = 'LogicalExpression';
|
|
5041
5080
|
const NewExpression$1 = 'NewExpression';
|
|
@@ -5043,6 +5082,8 @@ const Program$1 = 'Program';
|
|
|
5043
5082
|
const Property$1 = 'Property';
|
|
5044
5083
|
const ReturnStatement$1 = 'ReturnStatement';
|
|
5045
5084
|
const SequenceExpression$1 = 'SequenceExpression';
|
|
5085
|
+
const VariableDeclarator$1 = 'VariableDeclarator';
|
|
5086
|
+
const VariableDeclaration$1 = 'VariableDeclaration';
|
|
5046
5087
|
|
|
5047
5088
|
// this looks ridiculous, but it prevents sourcemap tooling from mistaking
|
|
5048
5089
|
// this for an actual sourceMappingURL
|
|
@@ -5114,6 +5155,28 @@ function markPureNode(node, comment, code) {
|
|
|
5114
5155
|
invalidAnnotation = true;
|
|
5115
5156
|
break;
|
|
5116
5157
|
}
|
|
5158
|
+
case ExportNamedDeclaration$1:
|
|
5159
|
+
case ExportDefaultDeclaration$1: {
|
|
5160
|
+
node = node.declaration;
|
|
5161
|
+
continue;
|
|
5162
|
+
}
|
|
5163
|
+
case VariableDeclaration$1: {
|
|
5164
|
+
|
|
5165
|
+
const declaration = node;
|
|
5166
|
+
if (declaration.kind === 'const') {
|
|
5167
|
+
// jsdoc only applies to the first declaration
|
|
5168
|
+
node = declaration.declarations[0].init;
|
|
5169
|
+
continue;
|
|
5170
|
+
}
|
|
5171
|
+
invalidAnnotation = true;
|
|
5172
|
+
break;
|
|
5173
|
+
}
|
|
5174
|
+
case VariableDeclarator$1: {
|
|
5175
|
+
node = node.init;
|
|
5176
|
+
continue;
|
|
5177
|
+
}
|
|
5178
|
+
case FunctionDeclaration$1:
|
|
5179
|
+
case ArrowFunctionExpression$1:
|
|
5117
5180
|
case CallExpression$1:
|
|
5118
5181
|
case NewExpression$1: {
|
|
5119
5182
|
break;
|
|
@@ -5156,15 +5219,20 @@ function doesNotMatchOutsideComment(code, forbiddenChars) {
|
|
|
5156
5219
|
}
|
|
5157
5220
|
return true;
|
|
5158
5221
|
}
|
|
5159
|
-
const
|
|
5222
|
+
const annotationsRegexes = [
|
|
5223
|
+
['pure', /[#@]__PURE__/],
|
|
5224
|
+
['noSideEffects', /[#@]__NO_SIDE_EFFECTS__/]
|
|
5225
|
+
];
|
|
5160
5226
|
function addAnnotations(comments, esTreeAst, code) {
|
|
5161
5227
|
const annotations = [];
|
|
5162
5228
|
const sourceMappingComments = [];
|
|
5163
5229
|
for (const comment of comments) {
|
|
5164
|
-
|
|
5165
|
-
|
|
5230
|
+
for (const [annotationType, regex] of annotationsRegexes) {
|
|
5231
|
+
if (regex.test(comment.value)) {
|
|
5232
|
+
annotations.push({ ...comment, annotationType });
|
|
5233
|
+
}
|
|
5166
5234
|
}
|
|
5167
|
-
|
|
5235
|
+
if (SOURCEMAPPING_URL_RE.test(comment.value)) {
|
|
5168
5236
|
sourceMappingComments.push(comment);
|
|
5169
5237
|
}
|
|
5170
5238
|
}
|
|
@@ -5308,7 +5376,12 @@ class NodeBase extends ExpressionEntity {
|
|
|
5308
5376
|
continue;
|
|
5309
5377
|
if (key.charCodeAt(0) === 95 /* _ */) {
|
|
5310
5378
|
if (key === ANNOTATION_KEY) {
|
|
5311
|
-
|
|
5379
|
+
const annotations = value;
|
|
5380
|
+
this.annotations = annotations;
|
|
5381
|
+
if (this.context.options.treeshake.annotations) {
|
|
5382
|
+
this.annotationNoSideEffects = annotations.some(comment => comment.annotationType === 'noSideEffects');
|
|
5383
|
+
this.annotationPure = annotations.some(comment => comment.annotationType === 'pure');
|
|
5384
|
+
}
|
|
5312
5385
|
}
|
|
5313
5386
|
else if (key === INVALID_COMMENT_KEY) {
|
|
5314
5387
|
for (const { start, end } of value)
|
|
@@ -7784,7 +7857,7 @@ class Identifier extends NodeBase {
|
|
|
7784
7857
|
}
|
|
7785
7858
|
}
|
|
7786
7859
|
disallowImportReassignment() {
|
|
7787
|
-
return this.context.error(
|
|
7860
|
+
return this.context.error(logIllegalImportReassignment(this.name, this.context.module.id), this.start);
|
|
7788
7861
|
}
|
|
7789
7862
|
getVariableRespectingTDZ() {
|
|
7790
7863
|
if (this.isPossibleTDZ()) {
|
|
@@ -7992,9 +8065,9 @@ class ExpressionStatement extends NodeBase {
|
|
|
7992
8065
|
if (this.directive &&
|
|
7993
8066
|
this.directive !== 'use strict' &&
|
|
7994
8067
|
this.parent.type === Program$1) {
|
|
7995
|
-
this.context.
|
|
8068
|
+
this.context.log(LOGLEVEL_WARN,
|
|
7996
8069
|
// This is necessary, because either way (deleting or not) can lead to errors.
|
|
7997
|
-
|
|
8070
|
+
logModuleLevelDirective(this.directive, this.context.module.id), this.start);
|
|
7998
8071
|
}
|
|
7999
8072
|
}
|
|
8000
8073
|
render(code, options) {
|
|
@@ -8160,6 +8233,9 @@ class FunctionBase extends NodeBase {
|
|
|
8160
8233
|
if (path.length > 0 || interaction.type !== INTERACTION_CALLED) {
|
|
8161
8234
|
return this.getObjectEntity().hasEffectsOnInteractionAtPath(path, interaction, context);
|
|
8162
8235
|
}
|
|
8236
|
+
if (this.annotationNoSideEffects) {
|
|
8237
|
+
return false;
|
|
8238
|
+
}
|
|
8163
8239
|
if (this.async) {
|
|
8164
8240
|
const { propertyReadSideEffects } = this.context.options
|
|
8165
8241
|
.treeshake;
|
|
@@ -8223,8 +8299,12 @@ class ArrowFunctionExpression extends FunctionBase {
|
|
|
8223
8299
|
return false;
|
|
8224
8300
|
}
|
|
8225
8301
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
8226
|
-
if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
8302
|
+
if (super.hasEffectsOnInteractionAtPath(path, interaction, context)) {
|
|
8227
8303
|
return true;
|
|
8304
|
+
}
|
|
8305
|
+
if (this.annotationNoSideEffects) {
|
|
8306
|
+
return false;
|
|
8307
|
+
}
|
|
8228
8308
|
if (interaction.type === INTERACTION_CALLED) {
|
|
8229
8309
|
const { ignore, brokenFlow } = context;
|
|
8230
8310
|
context.ignore = {
|
|
@@ -8530,11 +8610,17 @@ class FunctionNode extends FunctionBase {
|
|
|
8530
8610
|
hasEffects(context) {
|
|
8531
8611
|
if (!this.deoptimized)
|
|
8532
8612
|
this.applyDeoptimizations();
|
|
8613
|
+
if (this.annotationNoSideEffects) {
|
|
8614
|
+
return false;
|
|
8615
|
+
}
|
|
8533
8616
|
return !!this.id?.hasEffects(context);
|
|
8534
8617
|
}
|
|
8535
8618
|
hasEffectsOnInteractionAtPath(path, interaction, context) {
|
|
8536
8619
|
if (super.hasEffectsOnInteractionAtPath(path, interaction, context))
|
|
8537
8620
|
return true;
|
|
8621
|
+
if (this.annotationNoSideEffects) {
|
|
8622
|
+
return false;
|
|
8623
|
+
}
|
|
8538
8624
|
if (interaction.type === INTERACTION_CALLED) {
|
|
8539
8625
|
const thisInit = context.replacedVariableInits.get(this.scope.thisVariable);
|
|
8540
8626
|
context.replacedVariableInits.set(this.scope.thisVariable, interaction.withNew ? this.constructedEntity : UNKNOWN_EXPRESSION);
|
|
@@ -9030,7 +9116,7 @@ class MemberExpression extends NodeBase {
|
|
|
9030
9116
|
if (this.variable) {
|
|
9031
9117
|
this.context.includeVariableInModule(this.variable);
|
|
9032
9118
|
}
|
|
9033
|
-
this.context.
|
|
9119
|
+
this.context.log(LOGLEVEL_WARN, logIllegalImportReassignment(this.object.name, this.context.module.id), this.start);
|
|
9034
9120
|
}
|
|
9035
9121
|
}
|
|
9036
9122
|
}
|
|
@@ -9076,7 +9162,7 @@ function resolveNamespaceVariables(baseVariable, path, astContext) {
|
|
|
9076
9162
|
if (!variable) {
|
|
9077
9163
|
if (path.length === 1) {
|
|
9078
9164
|
const fileName = baseVariable.context.fileName;
|
|
9079
|
-
astContext.
|
|
9165
|
+
astContext.log(LOGLEVEL_WARN, logMissingExport(exportName, astContext.module.id, fileName), path[0].pos);
|
|
9080
9166
|
return 'undefined';
|
|
9081
9167
|
}
|
|
9082
9168
|
return null;
|
|
@@ -9183,10 +9269,10 @@ class CallExpression extends CallExpressionBase {
|
|
|
9183
9269
|
if (this.callee instanceof Identifier) {
|
|
9184
9270
|
const variable = this.scope.findVariable(this.callee.name);
|
|
9185
9271
|
if (variable.isNamespace) {
|
|
9186
|
-
this.context.
|
|
9272
|
+
this.context.log(LOGLEVEL_WARN, logCannotCallNamespace(this.callee.name), this.start);
|
|
9187
9273
|
}
|
|
9188
9274
|
if (this.callee.name === 'eval') {
|
|
9189
|
-
this.context.
|
|
9275
|
+
this.context.log(LOGLEVEL_WARN, logEval(this.context.module.id), this.start);
|
|
9190
9276
|
}
|
|
9191
9277
|
}
|
|
9192
9278
|
this.interaction = {
|
|
@@ -9206,9 +9292,9 @@ class CallExpression extends CallExpressionBase {
|
|
|
9206
9292
|
if (argument.hasEffects(context))
|
|
9207
9293
|
return true;
|
|
9208
9294
|
}
|
|
9209
|
-
if (this.
|
|
9210
|
-
this.annotations)
|
|
9295
|
+
if (this.annotationPure) {
|
|
9211
9296
|
return false;
|
|
9297
|
+
}
|
|
9212
9298
|
return (this.callee.hasEffects(context) ||
|
|
9213
9299
|
this.callee.hasEffectsOnInteractionAtPath(EMPTY_PATH, this.interaction, context));
|
|
9214
9300
|
}
|
|
@@ -11179,8 +11265,7 @@ class NewExpression extends NodeBase {
|
|
|
11179
11265
|
if (argument.hasEffects(context))
|
|
11180
11266
|
return true;
|
|
11181
11267
|
}
|
|
11182
|
-
if (this.
|
|
11183
|
-
this.annotations) {
|
|
11268
|
+
if (this.annotationPure) {
|
|
11184
11269
|
return false;
|
|
11185
11270
|
}
|
|
11186
11271
|
return (this.callee.hasEffects(context) ||
|
|
@@ -11300,29 +11385,6 @@ class ObjectExpression extends NodeBase {
|
|
|
11300
11385
|
class PrivateIdentifier extends NodeBase {
|
|
11301
11386
|
}
|
|
11302
11387
|
|
|
11303
|
-
function getOriginalLocation(sourcemapChain, location) {
|
|
11304
|
-
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
11305
|
-
traceSourcemap: while (filteredSourcemapChain.length > 0) {
|
|
11306
|
-
const sourcemap = filteredSourcemapChain.pop();
|
|
11307
|
-
const line = sourcemap.mappings[location.line - 1];
|
|
11308
|
-
if (line) {
|
|
11309
|
-
const filteredLine = line.filter((segment) => segment.length > 1);
|
|
11310
|
-
const lastSegment = filteredLine[filteredLine.length - 1];
|
|
11311
|
-
for (const segment of filteredLine) {
|
|
11312
|
-
if (segment[0] >= location.column || segment === lastSegment) {
|
|
11313
|
-
location = {
|
|
11314
|
-
column: segment[3],
|
|
11315
|
-
line: segment[2] + 1
|
|
11316
|
-
};
|
|
11317
|
-
continue traceSourcemap;
|
|
11318
|
-
}
|
|
11319
|
-
}
|
|
11320
|
-
}
|
|
11321
|
-
throw new Error("Can't resolve original location of error.");
|
|
11322
|
-
}
|
|
11323
|
-
return location;
|
|
11324
|
-
}
|
|
11325
|
-
|
|
11326
11388
|
class Program extends NodeBase {
|
|
11327
11389
|
constructor() {
|
|
11328
11390
|
super(...arguments);
|
|
@@ -11342,19 +11404,8 @@ class Program extends NodeBase {
|
|
|
11342
11404
|
if (node.hasEffects(context)) {
|
|
11343
11405
|
if (this.context.options.experimentalLogSideEffects && !this.hasLoggedEffect) {
|
|
11344
11406
|
this.hasLoggedEffect = true;
|
|
11345
|
-
const { code, module } = this.context;
|
|
11346
|
-
|
|
11347
|
-
console.log(`First side effect in ${relativeId(module.id)} is at (${line}:${column})\n${getCodeFrame(code, line, column)}`);
|
|
11348
|
-
try {
|
|
11349
|
-
const { column: originalColumn, line: originalLine } = getOriginalLocation(module.sourcemapChain, { column, line });
|
|
11350
|
-
if (originalLine !== line) {
|
|
11351
|
-
console.log(`Original location is at (${originalLine}:${originalColumn})\n${getCodeFrame(module.originalCode, originalLine, originalColumn)}\n`);
|
|
11352
|
-
}
|
|
11353
|
-
}
|
|
11354
|
-
catch {
|
|
11355
|
-
/* ignored */
|
|
11356
|
-
}
|
|
11357
|
-
console.log();
|
|
11407
|
+
const { code, log, module } = this.context;
|
|
11408
|
+
log(LOGLEVEL_INFO, logFirstSideEffect(code, module.id, locate(code, node.start, { offsetLine: 1 })), node.start);
|
|
11358
11409
|
}
|
|
11359
11410
|
return (this.hasCachedEffect = true);
|
|
11360
11411
|
}
|
|
@@ -11715,7 +11766,7 @@ class TaggedTemplateExpression extends CallExpressionBase {
|
|
|
11715
11766
|
const name = this.tag.name;
|
|
11716
11767
|
const variable = this.scope.findVariable(name);
|
|
11717
11768
|
if (variable.isNamespace) {
|
|
11718
|
-
this.context.
|
|
11769
|
+
this.context.log(LOGLEVEL_WARN, logCannotCallNamespace(name), this.start);
|
|
11719
11770
|
}
|
|
11720
11771
|
}
|
|
11721
11772
|
}
|
|
@@ -11962,7 +12013,7 @@ class ThisExpression extends NodeBase {
|
|
|
11962
12013
|
this.alias =
|
|
11963
12014
|
this.scope.findLexicalBoundary() instanceof ModuleScope ? this.context.moduleContext : null;
|
|
11964
12015
|
if (this.alias === 'undefined') {
|
|
11965
|
-
this.context.
|
|
12016
|
+
this.context.log(LOGLEVEL_WARN, logThisIsUndefined(), this.start);
|
|
11966
12017
|
}
|
|
11967
12018
|
}
|
|
11968
12019
|
render(code) {
|
|
@@ -12605,6 +12656,29 @@ function getId(m) {
|
|
|
12605
12656
|
return m.id;
|
|
12606
12657
|
}
|
|
12607
12658
|
|
|
12659
|
+
function getOriginalLocation(sourcemapChain, location) {
|
|
12660
|
+
const filteredSourcemapChain = sourcemapChain.filter((sourcemap) => !!sourcemap.mappings);
|
|
12661
|
+
traceSourcemap: while (filteredSourcemapChain.length > 0) {
|
|
12662
|
+
const sourcemap = filteredSourcemapChain.pop();
|
|
12663
|
+
const line = sourcemap.mappings[location.line - 1];
|
|
12664
|
+
if (line) {
|
|
12665
|
+
const filteredLine = line.filter((segment) => segment.length > 1);
|
|
12666
|
+
const lastSegment = filteredLine[filteredLine.length - 1];
|
|
12667
|
+
for (const segment of filteredLine) {
|
|
12668
|
+
if (segment[0] >= location.column || segment === lastSegment) {
|
|
12669
|
+
location = {
|
|
12670
|
+
column: segment[3],
|
|
12671
|
+
line: segment[2] + 1
|
|
12672
|
+
};
|
|
12673
|
+
continue traceSourcemap;
|
|
12674
|
+
}
|
|
12675
|
+
}
|
|
12676
|
+
}
|
|
12677
|
+
throw new Error("Can't resolve original location of error.");
|
|
12678
|
+
}
|
|
12679
|
+
return location;
|
|
12680
|
+
}
|
|
12681
|
+
|
|
12608
12682
|
function getAssertionsFromImportExpression(node) {
|
|
12609
12683
|
const assertProperty = node.arguments?.[0]?.properties.find((property) => getPropertyKey(property) === 'assert')?.value;
|
|
12610
12684
|
if (!assertProperty) {
|
|
@@ -12781,7 +12855,7 @@ function getVariableForExportNameRecursive(target, name, importerForSideEffects,
|
|
|
12781
12855
|
const searchedModules = searchedNamesAndModules.get(name);
|
|
12782
12856
|
if (searchedModules) {
|
|
12783
12857
|
if (searchedModules.has(target)) {
|
|
12784
|
-
return isExportAllSearch ? [null] : error(
|
|
12858
|
+
return isExportAllSearch ? [null] : error(logCircularReexport(name, target.id));
|
|
12785
12859
|
}
|
|
12786
12860
|
searchedModules.add(target);
|
|
12787
12861
|
}
|
|
@@ -13107,7 +13181,7 @@ class Module {
|
|
|
13107
13181
|
: 'default', { onlyExplicit: true });
|
|
13108
13182
|
}
|
|
13109
13183
|
if (!this.syntheticNamespace) {
|
|
13110
|
-
return error(
|
|
13184
|
+
return error(logSyntheticNamedExportsNeedNamespaceExport(this.id, this.info.syntheticNamedExports));
|
|
13111
13185
|
}
|
|
13112
13186
|
return this.syntheticNamespace;
|
|
13113
13187
|
}
|
|
@@ -13126,7 +13200,7 @@ class Module {
|
|
|
13126
13200
|
if (reexportDeclaration) {
|
|
13127
13201
|
const [variable] = getVariableForExportNameRecursive(reexportDeclaration.module, reexportDeclaration.localName, importerForSideEffects, false, searchedNamesAndModules);
|
|
13128
13202
|
if (!variable) {
|
|
13129
|
-
return this.error(
|
|
13203
|
+
return this.error(logMissingExport(reexportDeclaration.localName, this.id, reexportDeclaration.module.id), reexportDeclaration.start);
|
|
13130
13204
|
}
|
|
13131
13205
|
if (importerForSideEffects) {
|
|
13132
13206
|
setAlternativeExporterIfCyclic(variable, importerForSideEffects, this);
|
|
@@ -13263,13 +13337,17 @@ class Module {
|
|
|
13263
13337
|
}
|
|
13264
13338
|
this.exportAllModules.push(...externalExportAllModules);
|
|
13265
13339
|
}
|
|
13340
|
+
log(level, properties, pos) {
|
|
13341
|
+
this.addLocationToLogProps(properties, pos);
|
|
13342
|
+
this.options.onLog(level, properties);
|
|
13343
|
+
}
|
|
13266
13344
|
render(options) {
|
|
13267
13345
|
const source = this.magicString.clone();
|
|
13268
13346
|
this.ast.render(source, options);
|
|
13269
13347
|
source.trim();
|
|
13270
13348
|
const { usesTopLevelAwait } = this.astContext;
|
|
13271
13349
|
if (usesTopLevelAwait && options.format !== 'es' && options.format !== 'system') {
|
|
13272
|
-
return error(
|
|
13350
|
+
return error(logInvalidFormatForTopLevelAwait(this.id, options.format));
|
|
13273
13351
|
}
|
|
13274
13352
|
return { source, usesTopLevelAwait };
|
|
13275
13353
|
}
|
|
@@ -13314,6 +13392,7 @@ class Module {
|
|
|
13314
13392
|
includeAllExports: () => this.includeAllExports(true),
|
|
13315
13393
|
includeDynamicImport: this.includeDynamicImport.bind(this),
|
|
13316
13394
|
includeVariableInModule: this.includeVariableInModule.bind(this),
|
|
13395
|
+
log: this.log.bind(this),
|
|
13317
13396
|
magicString: this.magicString,
|
|
13318
13397
|
manualPureFunctions: this.graph.pureFunctions,
|
|
13319
13398
|
module: this,
|
|
@@ -13322,8 +13401,7 @@ class Module {
|
|
|
13322
13401
|
requestTreeshakingPass: () => (this.graph.needsTreeshakingPass = true),
|
|
13323
13402
|
traceExport: (name) => this.getVariableForExportName(name)[0],
|
|
13324
13403
|
traceVariable: this.traceVariable.bind(this),
|
|
13325
|
-
usesTopLevelAwait: false
|
|
13326
|
-
warn: this.warn.bind(this)
|
|
13404
|
+
usesTopLevelAwait: false
|
|
13327
13405
|
};
|
|
13328
13406
|
this.scope = new ModuleScope(this.graph.scope, this.astContext);
|
|
13329
13407
|
this.namespace = new NamespaceVariable(this.astContext);
|
|
@@ -13383,7 +13461,7 @@ class Module {
|
|
|
13383
13461
|
}
|
|
13384
13462
|
const [declaration] = getVariableForExportNameRecursive(otherModule, importDescription.name, importerForSideEffects || this, isExportAllSearch, searchedNamesAndModules);
|
|
13385
13463
|
if (!declaration) {
|
|
13386
|
-
return this.error(
|
|
13464
|
+
return this.error(logMissingExport(importDescription.name, this.id, otherModule.id), importDescription.start);
|
|
13387
13465
|
}
|
|
13388
13466
|
return declaration;
|
|
13389
13467
|
}
|
|
@@ -13400,10 +13478,6 @@ class Module {
|
|
|
13400
13478
|
Object.assign(this.info.meta, meta);
|
|
13401
13479
|
}
|
|
13402
13480
|
}
|
|
13403
|
-
warn(properties, pos) {
|
|
13404
|
-
this.addLocationToLogProps(properties, pos);
|
|
13405
|
-
this.options.onwarn(properties);
|
|
13406
|
-
}
|
|
13407
13481
|
addDynamicImport(node) {
|
|
13408
13482
|
let argument = node.source;
|
|
13409
13483
|
if (argument instanceof TemplateLiteral) {
|
|
@@ -13517,7 +13591,7 @@ class Module {
|
|
|
13517
13591
|
code = this.originalCode;
|
|
13518
13592
|
}
|
|
13519
13593
|
catch (error_) {
|
|
13520
|
-
this.options.
|
|
13594
|
+
this.options.onLog(LOGLEVEL_WARN, logInvalidSourcemapForError(error_, this.id, column, line, pos));
|
|
13521
13595
|
}
|
|
13522
13596
|
augmentCodeLocation(properties, { column, line }, code, this.id);
|
|
13523
13597
|
}
|
|
@@ -13558,7 +13632,7 @@ class Module {
|
|
|
13558
13632
|
const existingAssertions = this.sourcesWithAssertions.get(source);
|
|
13559
13633
|
if (existingAssertions) {
|
|
13560
13634
|
if (doAssertionsDiffer(existingAssertions, parsedAssertions)) {
|
|
13561
|
-
this.
|
|
13635
|
+
this.log(LOGLEVEL_WARN, logInconsistentImportAssertions(existingAssertions, parsedAssertions, source, this.id), declaration.start);
|
|
13562
13636
|
}
|
|
13563
13637
|
}
|
|
13564
13638
|
else {
|
|
@@ -13596,7 +13670,7 @@ class Module {
|
|
|
13596
13670
|
if (foundDeclarationList.length === 1) {
|
|
13597
13671
|
return [usedDeclaration];
|
|
13598
13672
|
}
|
|
13599
|
-
this.options.
|
|
13673
|
+
this.options.onLog(LOGLEVEL_WARN, logNamespaceConflict(name, this.id, foundDeclarationList.map(([, module]) => module.id)));
|
|
13600
13674
|
// TODO we are pretending it was not found while it should behave like "undefined"
|
|
13601
13675
|
return [null];
|
|
13602
13676
|
}
|
|
@@ -13604,7 +13678,7 @@ class Module {
|
|
|
13604
13678
|
const foundDeclarationList = [...foundExternalDeclarations];
|
|
13605
13679
|
const usedDeclaration = foundDeclarationList[0];
|
|
13606
13680
|
if (foundDeclarationList.length > 1) {
|
|
13607
|
-
this.options.
|
|
13681
|
+
this.options.onLog(LOGLEVEL_WARN, logAmbiguousExternalNamespaces(name, this.id, usedDeclaration.module.id, foundDeclarationList.map(declaration => declaration.module.id)));
|
|
13608
13682
|
}
|
|
13609
13683
|
return [usedDeclaration, true];
|
|
13610
13684
|
}
|
|
@@ -13648,10 +13722,15 @@ class Module {
|
|
|
13648
13722
|
}
|
|
13649
13723
|
}
|
|
13650
13724
|
includeVariable(variable) {
|
|
13651
|
-
|
|
13725
|
+
const variableModule = variable.module;
|
|
13726
|
+
if (variable.included) {
|
|
13727
|
+
if (variableModule instanceof Module && variableModule !== this) {
|
|
13728
|
+
getAndExtendSideEffectModules(variable, this);
|
|
13729
|
+
}
|
|
13730
|
+
}
|
|
13731
|
+
else {
|
|
13652
13732
|
variable.include();
|
|
13653
13733
|
this.graph.needsTreeshakingPass = true;
|
|
13654
|
-
const variableModule = variable.module;
|
|
13655
13734
|
if (variableModule instanceof Module) {
|
|
13656
13735
|
if (!variableModule.isExecuted) {
|
|
13657
13736
|
markModuleAndImpureDependenciesAsExecuted(variableModule);
|
|
@@ -13675,7 +13754,7 @@ class Module {
|
|
|
13675
13754
|
}
|
|
13676
13755
|
}
|
|
13677
13756
|
shimMissingExport(name) {
|
|
13678
|
-
this.options.
|
|
13757
|
+
this.options.onLog(LOGLEVEL_WARN, logShimmedExport(this.id, name));
|
|
13679
13758
|
this.exports.set(name, MISSING_EXPORT_SHIM_DESCRIPTION);
|
|
13680
13759
|
}
|
|
13681
13760
|
tryParse() {
|
|
@@ -13683,7 +13762,7 @@ class Module {
|
|
|
13683
13762
|
return this.graph.contextParse(this.info.code);
|
|
13684
13763
|
}
|
|
13685
13764
|
catch (error_) {
|
|
13686
|
-
return this.error(
|
|
13765
|
+
return this.error(logParseError(error_, this.id), error_.pos);
|
|
13687
13766
|
}
|
|
13688
13767
|
}
|
|
13689
13768
|
}
|
|
@@ -13984,17 +14063,17 @@ const nodeBuiltins = new Set([
|
|
|
13984
14063
|
'timers/promises',
|
|
13985
14064
|
'util/types'
|
|
13986
14065
|
]);
|
|
13987
|
-
function warnOnBuiltins(
|
|
14066
|
+
function warnOnBuiltins(log, dependencies) {
|
|
13988
14067
|
const externalBuiltins = dependencies
|
|
13989
14068
|
.map(({ importPath }) => importPath)
|
|
13990
14069
|
.filter(importPath => nodeBuiltins.has(importPath) || importPath.startsWith('node:'));
|
|
13991
14070
|
if (externalBuiltins.length === 0)
|
|
13992
14071
|
return;
|
|
13993
|
-
|
|
14072
|
+
log(LOGLEVEL_WARN, logMissingNodeBuiltins(externalBuiltins));
|
|
13994
14073
|
}
|
|
13995
14074
|
|
|
13996
|
-
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, outro, snippets
|
|
13997
|
-
warnOnBuiltins(
|
|
14075
|
+
function amd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, isEntryFacade, isModuleFacade, namedExportsMode, log, outro, snippets }, { amd, esModule, externalLiveBindings, freeze, interop, namespaceToStringTag, strict }) {
|
|
14076
|
+
warnOnBuiltins(log, dependencies);
|
|
13998
14077
|
const deps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
13999
14078
|
const parameters = dependencies.map(m => m.name);
|
|
14000
14079
|
const { n, getNonArrowFunctionIntro, _ } = snippets;
|
|
@@ -14219,19 +14298,19 @@ function trimEmptyImports(dependencies) {
|
|
|
14219
14298
|
return [];
|
|
14220
14299
|
}
|
|
14221
14300
|
|
|
14222
|
-
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, outro, snippets
|
|
14301
|
+
function iife(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, indent: t, intro, namedExportsMode, log, outro, snippets }, { compact, esModule, extend, freeze, externalLiveBindings, globals, interop, name, namespaceToStringTag, strict }) {
|
|
14223
14302
|
const { _, getNonArrowFunctionIntro, getPropertyAccess, n } = snippets;
|
|
14224
14303
|
const isNamespaced = name && name.includes('.');
|
|
14225
14304
|
const useVariableAssignment = !extend && !isNamespaced;
|
|
14226
14305
|
if (name && useVariableAssignment && !isLegal(name)) {
|
|
14227
|
-
return error(
|
|
14306
|
+
return error(logIllegalIdentifierAsName(name));
|
|
14228
14307
|
}
|
|
14229
|
-
warnOnBuiltins(
|
|
14308
|
+
warnOnBuiltins(log, dependencies);
|
|
14230
14309
|
const external = trimEmptyImports(dependencies);
|
|
14231
14310
|
const deps = external.map(dep => dep.globalName || 'null');
|
|
14232
14311
|
const parameters = external.map(m => m.name);
|
|
14233
14312
|
if (hasExports && !name) {
|
|
14234
|
-
|
|
14313
|
+
log(LOGLEVEL_WARN, logMissingNameOptionForIifeExport());
|
|
14235
14314
|
}
|
|
14236
14315
|
if (namedExportsMode && hasExports) {
|
|
14237
14316
|
if (extend) {
|
|
@@ -14423,14 +14502,14 @@ function safeAccess(name, globalVariable, { _, getPropertyAccess }) {
|
|
|
14423
14502
|
.map(part => (propertyPath += getPropertyAccess(part)))
|
|
14424
14503
|
.join(`${_}&&${_}`);
|
|
14425
14504
|
}
|
|
14426
|
-
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, outro, snippets
|
|
14505
|
+
function umd(magicString, { accessedGlobals, dependencies, exports, hasDefaultExport, hasExports, id, indent: t, intro, namedExportsMode, log, outro, snippets }, { amd, compact, esModule, extend, externalLiveBindings, freeze, interop, name, namespaceToStringTag, globals, noConflict, strict }) {
|
|
14427
14506
|
const { _, cnst, getFunctionIntro, getNonArrowFunctionIntro, getPropertyAccess, n, s } = snippets;
|
|
14428
14507
|
const factoryVariable = compact ? 'f' : 'factory';
|
|
14429
14508
|
const globalVariable = compact ? 'g' : 'global';
|
|
14430
14509
|
if (hasExports && !name) {
|
|
14431
|
-
return error(
|
|
14510
|
+
return error(logMissingNameOptionForUmdExport());
|
|
14432
14511
|
}
|
|
14433
|
-
warnOnBuiltins(
|
|
14512
|
+
warnOnBuiltins(log, dependencies);
|
|
14434
14513
|
const amdDeps = dependencies.map(m => `'${updateExtensionForRelativeAmdId(m.importPath, amd.forceJsExtensionForImports)}'`);
|
|
14435
14514
|
const cjsDeps = dependencies.map(m => `require('${m.importPath}')`);
|
|
14436
14515
|
const trimmedImports = trimEmptyImports(dependencies);
|
|
@@ -14540,7 +14619,7 @@ async function createAddons(options, outputPluginDriver, chunk) {
|
|
|
14540
14619
|
return { banner, footer, intro, outro };
|
|
14541
14620
|
}
|
|
14542
14621
|
catch (error_) {
|
|
14543
|
-
return error(
|
|
14622
|
+
return error(logAddonNotGenerated(error_.message, error_.hook, error_.plugin));
|
|
14544
14623
|
}
|
|
14545
14624
|
}
|
|
14546
14625
|
|
|
@@ -14693,15 +14772,15 @@ function assignExportsToNames(exports, exportsByName, exportNamesByVariable) {
|
|
|
14693
14772
|
}
|
|
14694
14773
|
}
|
|
14695
14774
|
|
|
14696
|
-
function getExportMode(chunk, { exports: exportMode, name, format }, facadeModuleId,
|
|
14775
|
+
function getExportMode(chunk, { exports: exportMode, name, format }, facadeModuleId, log) {
|
|
14697
14776
|
const exportKeys = chunk.getExportNames();
|
|
14698
14777
|
if (exportMode === 'default') {
|
|
14699
14778
|
if (exportKeys.length !== 1 || exportKeys[0] !== 'default') {
|
|
14700
|
-
return error(
|
|
14779
|
+
return error(logIncompatibleExportOptionValue('default', exportKeys, facadeModuleId));
|
|
14701
14780
|
}
|
|
14702
14781
|
}
|
|
14703
14782
|
else if (exportMode === 'none' && exportKeys.length > 0) {
|
|
14704
|
-
return error(
|
|
14783
|
+
return error(logIncompatibleExportOptionValue('none', exportKeys, facadeModuleId));
|
|
14705
14784
|
}
|
|
14706
14785
|
if (exportMode === 'auto') {
|
|
14707
14786
|
if (exportKeys.length === 0) {
|
|
@@ -14712,7 +14791,7 @@ function getExportMode(chunk, { exports: exportMode, name, format }, facadeModul
|
|
|
14712
14791
|
}
|
|
14713
14792
|
else {
|
|
14714
14793
|
if (format !== 'es' && format !== 'system' && exportKeys.includes('default')) {
|
|
14715
|
-
|
|
14794
|
+
log(LOGLEVEL_WARN, logMixedExport(facadeModuleId, name));
|
|
14716
14795
|
}
|
|
14717
14796
|
exportMode = 'named';
|
|
14718
14797
|
}
|
|
@@ -14789,7 +14868,8 @@ function addStaticDependencies(module, staticDependencies, handledModules, chunk
|
|
|
14789
14868
|
}
|
|
14790
14869
|
}
|
|
14791
14870
|
|
|
14792
|
-
// Four random characters from the private use area to minimize risk of
|
|
14871
|
+
// Four random characters from the private use area to minimize risk of
|
|
14872
|
+
// conflicts
|
|
14793
14873
|
const hashPlaceholderLeft = '!~{';
|
|
14794
14874
|
const hashPlaceholderRight = '}~';
|
|
14795
14875
|
const hashPlaceholderOverhead = hashPlaceholderLeft.length + hashPlaceholderRight.length;
|
|
@@ -14800,11 +14880,11 @@ const getHashPlaceholderGenerator = () => {
|
|
|
14800
14880
|
let nextIndex = 0;
|
|
14801
14881
|
return (optionName, hashSize = defaultHashSize) => {
|
|
14802
14882
|
if (hashSize > maxHashSize) {
|
|
14803
|
-
return error(
|
|
14883
|
+
return error(logFailedValidation(`Hashes cannot be longer than ${maxHashSize} characters, received ${hashSize}. Check the "${optionName}" option.`));
|
|
14804
14884
|
}
|
|
14805
14885
|
const placeholder = `${hashPlaceholderLeft}${toBase64(++nextIndex).padStart(hashSize - hashPlaceholderOverhead, '0')}${hashPlaceholderRight}`;
|
|
14806
14886
|
if (placeholder.length > hashSize) {
|
|
14807
|
-
return error(
|
|
14887
|
+
return error(logFailedValidation(`To generate hashes for this number of chunks (currently ${nextIndex}), you need a minimum hash size of ${placeholder.length}, received ${hashSize}. Check the "${optionName}" option.`));
|
|
14808
14888
|
}
|
|
14809
14889
|
return placeholder;
|
|
14810
14890
|
};
|
|
@@ -14871,14 +14951,14 @@ const removeUnreferencedAssets = (outputBundle) => {
|
|
|
14871
14951
|
|
|
14872
14952
|
function renderNamePattern(pattern, patternName, replacements) {
|
|
14873
14953
|
if (isPathFragment(pattern))
|
|
14874
|
-
return error(
|
|
14954
|
+
return error(logFailedValidation(`Invalid pattern "${pattern}" for "${patternName}", patterns can be neither absolute nor relative paths. If you want your files to be stored in a subdirectory, write its name without a leading slash like this: subdirectory/pattern.`));
|
|
14875
14955
|
return pattern.replace(/\[(\w+)(:\d+)?]/g, (_match, type, size) => {
|
|
14876
14956
|
if (!replacements.hasOwnProperty(type) || (size && type !== 'hash')) {
|
|
14877
|
-
return error(
|
|
14957
|
+
return error(logFailedValidation(`"[${type}${size || ''}]" is not a valid placeholder in the "${patternName}" pattern.`));
|
|
14878
14958
|
}
|
|
14879
14959
|
const replacement = replacements[type](size && Number.parseInt(size.slice(1)));
|
|
14880
14960
|
if (isPathFragment(replacement))
|
|
14881
|
-
return error(
|
|
14961
|
+
return error(logFailedValidation(`Invalid substitution "${replacement}" for placeholder "[${type}]" in "${patternName}" pattern, can be neither absolute nor relative path.`));
|
|
14882
14962
|
return replacement;
|
|
14883
14963
|
});
|
|
14884
14964
|
}
|
|
@@ -14903,13 +14983,13 @@ const NON_ASSET_EXTENSIONS = new Set([
|
|
|
14903
14983
|
'.cjs',
|
|
14904
14984
|
'.cts'
|
|
14905
14985
|
]);
|
|
14906
|
-
function getGlobalName(chunk, globals, hasExports,
|
|
14986
|
+
function getGlobalName(chunk, globals, hasExports, log) {
|
|
14907
14987
|
const globalName = typeof globals === 'function' ? globals(chunk.id) : globals[chunk.id];
|
|
14908
14988
|
if (globalName) {
|
|
14909
14989
|
return globalName;
|
|
14910
14990
|
}
|
|
14911
14991
|
if (hasExports) {
|
|
14912
|
-
|
|
14992
|
+
log(LOGLEVEL_WARN, logMissingGlobalName(chunk.id, chunk.variableName));
|
|
14913
14993
|
return chunk.variableName;
|
|
14914
14994
|
}
|
|
14915
14995
|
}
|
|
@@ -15068,7 +15148,7 @@ class Chunk {
|
|
|
15068
15148
|
assignExportsToNames(remainingExports, this.exportsByName, this.exportNamesByVariable);
|
|
15069
15149
|
}
|
|
15070
15150
|
if (this.outputOptions.preserveModules || (this.facadeModule && this.facadeModule.info.isEntry))
|
|
15071
|
-
this.exportMode = getExportMode(this, this.outputOptions, this.facadeModule.id, this.inputOptions.
|
|
15151
|
+
this.exportMode = getExportMode(this, this.outputOptions, this.facadeModule.id, this.inputOptions.onLog);
|
|
15072
15152
|
}
|
|
15073
15153
|
generateFacades() {
|
|
15074
15154
|
const facades = [];
|
|
@@ -15216,7 +15296,7 @@ class Chunk {
|
|
|
15216
15296
|
}
|
|
15217
15297
|
}
|
|
15218
15298
|
async render() {
|
|
15219
|
-
const { dependencies, exportMode, facadeModule, inputOptions: {
|
|
15299
|
+
const { dependencies, exportMode, facadeModule, inputOptions: { onLog }, outputOptions, pluginDriver, snippets } = this;
|
|
15220
15300
|
const { format, hoistTransitiveImports, preserveModules } = outputOptions;
|
|
15221
15301
|
// for static and dynamic entry points, add transitive dependencies to this
|
|
15222
15302
|
// chunk's dependencies to avoid loading latency
|
|
@@ -15266,8 +15346,8 @@ class Chunk {
|
|
|
15266
15346
|
intro,
|
|
15267
15347
|
isEntryFacade: preserveModules || (facadeModule !== null && facadeModule.info.isEntry),
|
|
15268
15348
|
isModuleFacade: facadeModule !== null,
|
|
15349
|
+
log: onLog,
|
|
15269
15350
|
namedExportsMode: exportMode !== 'default',
|
|
15270
|
-
onwarn,
|
|
15271
15351
|
outro,
|
|
15272
15352
|
snippets,
|
|
15273
15353
|
usesTopLevelAwait
|
|
@@ -15322,7 +15402,7 @@ class Chunk {
|
|
|
15322
15402
|
if (alternativeReexportModule) {
|
|
15323
15403
|
const exportingChunk = this.chunkByModule.get(alternativeReexportModule);
|
|
15324
15404
|
if (exportingChunk !== exportChunk) {
|
|
15325
|
-
this.inputOptions.
|
|
15405
|
+
this.inputOptions.onLog(LOGLEVEL_WARN, logCyclicCrossChunkReexport(
|
|
15326
15406
|
// Namespaces do not have an export name
|
|
15327
15407
|
variableModule.getExportNamesByVariable().get(variable)?.[0] || '*', variableModule.id, alternativeReexportModule.id, importingModule.id, this.outputOptions.preserveModules));
|
|
15328
15408
|
}
|
|
@@ -15510,7 +15590,7 @@ class Chunk {
|
|
|
15510
15590
|
dependency = this.externalChunkByModule.get(module);
|
|
15511
15591
|
imported = variable.name;
|
|
15512
15592
|
if (imported !== 'default' && imported !== '*' && interop(module.id) === 'defaultOnly') {
|
|
15513
|
-
return error(
|
|
15593
|
+
return error(logUnexpectedNamedImport(module.id, imported, false));
|
|
15514
15594
|
}
|
|
15515
15595
|
}
|
|
15516
15596
|
else {
|
|
@@ -15600,7 +15680,7 @@ class Chunk {
|
|
|
15600
15680
|
if (exportName[0] === '*') {
|
|
15601
15681
|
const id = exportName.slice(1);
|
|
15602
15682
|
if (interop(id) === 'defaultOnly') {
|
|
15603
|
-
this.inputOptions.
|
|
15683
|
+
this.inputOptions.onLog(LOGLEVEL_WARN, logUnexpectedNamespaceReexport(id));
|
|
15604
15684
|
}
|
|
15605
15685
|
needsLiveBinding = externalLiveBindings;
|
|
15606
15686
|
dependency = this.externalChunkByModule.get(this.modulesById.get(id));
|
|
@@ -15622,7 +15702,7 @@ class Chunk {
|
|
|
15622
15702
|
dependency = this.externalChunkByModule.get(module);
|
|
15623
15703
|
imported = variable.name;
|
|
15624
15704
|
if (imported !== 'default' && imported !== '*' && interop(module.id) === 'defaultOnly') {
|
|
15625
|
-
return error(
|
|
15705
|
+
return error(logUnexpectedNamedImport(module.id, imported, true));
|
|
15626
15706
|
}
|
|
15627
15707
|
needsLiveBinding =
|
|
15628
15708
|
externalLiveBindings &&
|
|
@@ -15667,7 +15747,7 @@ class Chunk {
|
|
|
15667
15747
|
defaultVariableName: dep.defaultVariableName,
|
|
15668
15748
|
globalName: dep instanceof ExternalChunk &&
|
|
15669
15749
|
(this.outputOptions.format === 'umd' || this.outputOptions.format === 'iife') &&
|
|
15670
|
-
getGlobalName(dep, this.outputOptions.globals, (imports || reexports) !== null, this.inputOptions.
|
|
15750
|
+
getGlobalName(dep, this.outputOptions.globals, (imports || reexports) !== null, this.inputOptions.onLog),
|
|
15671
15751
|
importPath,
|
|
15672
15752
|
imports,
|
|
15673
15753
|
isChunk: dep instanceof Chunk,
|
|
@@ -15691,7 +15771,7 @@ class Chunk {
|
|
|
15691
15771
|
}
|
|
15692
15772
|
// This method changes properties on the AST before rendering and must not be async
|
|
15693
15773
|
renderModules(fileName) {
|
|
15694
|
-
const { accessedGlobalsByScope, dependencies, exportNamesByVariable, includedNamespaces, inputOptions: {
|
|
15774
|
+
const { accessedGlobalsByScope, dependencies, exportNamesByVariable, includedNamespaces, inputOptions: { onLog }, isEmpty, orderedModules, outputOptions, pluginDriver, renderedModules, snippets } = this;
|
|
15695
15775
|
const { compact, dynamicImportFunction, format, freeze, namespaceToStringTag } = outputOptions;
|
|
15696
15776
|
const { _, cnst, n } = snippets;
|
|
15697
15777
|
this.setDynamicImportResolutions(fileName);
|
|
@@ -15764,7 +15844,7 @@ class Chunk {
|
|
|
15764
15844
|
}
|
|
15765
15845
|
const renderedSource = compact ? magicString : magicString.trim();
|
|
15766
15846
|
if (isEmpty && this.getExportNames().length === 0 && dependencies.size === 0) {
|
|
15767
|
-
|
|
15847
|
+
onLog(LOGLEVEL_WARN, logEmptyChunk(this.getChunkName()));
|
|
15768
15848
|
}
|
|
15769
15849
|
return { accessedGlobals, indent, magicString, renderedSource, usedModules, usesTopLevelAwait };
|
|
15770
15850
|
}
|
|
@@ -16053,7 +16133,7 @@ function* concatLazy(iterables) {
|
|
|
16053
16133
|
* those chunks that are already loaded for that dynamic entry and create
|
|
16054
16134
|
* another round of chunks.
|
|
16055
16135
|
*/
|
|
16056
|
-
function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
|
|
16136
|
+
function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize, log) {
|
|
16057
16137
|
const { chunkDefinitions, modulesInManualChunks } = getChunkDefinitionsFromManualChunks(manualChunkAliasByEntry);
|
|
16058
16138
|
const { allEntries, dependentEntriesByModule, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry } = analyzeModuleGraph(entries);
|
|
16059
16139
|
// Each chunk is identified by its position in this array
|
|
@@ -16061,7 +16141,7 @@ function getChunkAssignments(entries, manualChunkAliasByEntry, minChunkSize) {
|
|
|
16061
16141
|
// This mutates initialChunks but also clears
|
|
16062
16142
|
// dynamicallyDependentEntriesByDynamicEntry as side effect
|
|
16063
16143
|
removeUnnecessaryDependentEntries(initialChunks, dynamicallyDependentEntriesByDynamicEntry, dynamicImportsByEntry, allEntries);
|
|
16064
|
-
chunkDefinitions.push(...getOptimizedChunks(getChunksFromDependentEntries(initialChunks), allEntries.length, minChunkSize).map(({ modules }) => ({
|
|
16144
|
+
chunkDefinitions.push(...getOptimizedChunks(getChunksFromDependentEntries(initialChunks), allEntries.length, minChunkSize, log).map(({ modules }) => ({
|
|
16065
16145
|
alias: null,
|
|
16066
16146
|
modules
|
|
16067
16147
|
})));
|
|
@@ -16317,7 +16397,7 @@ function removeUnnecessaryDependentEntries(chunks, dynamicallyDependentEntriesBy
|
|
|
16317
16397
|
* following the rule (a), starting with the smallest chunks to look for
|
|
16318
16398
|
* possible merge targets.
|
|
16319
16399
|
*/
|
|
16320
|
-
function getOptimizedChunks(initialChunks, numberOfEntries, minChunkSize) {
|
|
16400
|
+
function getOptimizedChunks(initialChunks, numberOfEntries, minChunkSize, log) {
|
|
16321
16401
|
timeStart('optimize chunks', 3);
|
|
16322
16402
|
const chunkPartition = getPartitionedChunks(initialChunks, numberOfEntries, minChunkSize);
|
|
16323
16403
|
if (!chunkPartition) {
|
|
@@ -16325,10 +16405,10 @@ function getOptimizedChunks(initialChunks, numberOfEntries, minChunkSize) {
|
|
|
16325
16405
|
return initialChunks; // the actual modules
|
|
16326
16406
|
}
|
|
16327
16407
|
minChunkSize > 1 &&
|
|
16328
|
-
|
|
16408
|
+
log('info', logOptimizeChunkStatus(initialChunks.length, chunkPartition.small.size, 'Initially'));
|
|
16329
16409
|
mergeChunks(chunkPartition, minChunkSize);
|
|
16330
16410
|
minChunkSize > 1 &&
|
|
16331
|
-
|
|
16411
|
+
log('info', logOptimizeChunkStatus(chunkPartition.small.size + chunkPartition.big.size, chunkPartition.small.size, 'After merging chunks'));
|
|
16332
16412
|
timeEnd('optimize chunks', 3);
|
|
16333
16413
|
return [...chunkPartition.small, ...chunkPartition.big];
|
|
16334
16414
|
}
|
|
@@ -16739,7 +16819,7 @@ class Link {
|
|
|
16739
16819
|
sourcesContent[sourceIndex] = content;
|
|
16740
16820
|
}
|
|
16741
16821
|
else if (content != null && sourcesContent[sourceIndex] !== content) {
|
|
16742
|
-
return error(
|
|
16822
|
+
return error(logConflictingSourcemapSources(filename));
|
|
16743
16823
|
}
|
|
16744
16824
|
const tracedSegment = [segment[0], sourceIndex, line, column];
|
|
16745
16825
|
if (name) {
|
|
@@ -16789,12 +16869,12 @@ class Link {
|
|
|
16789
16869
|
return null;
|
|
16790
16870
|
}
|
|
16791
16871
|
}
|
|
16792
|
-
function getLinkMap(
|
|
16872
|
+
function getLinkMap(log) {
|
|
16793
16873
|
return function linkMap(source, map) {
|
|
16794
16874
|
if (map.mappings) {
|
|
16795
16875
|
return new Link(map, [source]);
|
|
16796
16876
|
}
|
|
16797
|
-
|
|
16877
|
+
log(LOGLEVEL_WARN, logSourcemapBroken(map.plugin));
|
|
16798
16878
|
return new Link({
|
|
16799
16879
|
mappings: [],
|
|
16800
16880
|
names: []
|
|
@@ -16816,8 +16896,8 @@ function getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapCha
|
|
|
16816
16896
|
}
|
|
16817
16897
|
return sourcemapChain.reduce(linkMap, source);
|
|
16818
16898
|
}
|
|
16819
|
-
function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent,
|
|
16820
|
-
const linkMap = getLinkMap(
|
|
16899
|
+
function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeContent, log) {
|
|
16900
|
+
const linkMap = getLinkMap(log);
|
|
16821
16901
|
const moduleSources = modules
|
|
16822
16902
|
.filter(module => !module.excludeFromSourcemap)
|
|
16823
16903
|
.map(module => getCollapsedSourcemap(module.id, module.originalCode, module.originalSourcemap, module.sourcemapChain, linkMap));
|
|
@@ -16832,11 +16912,11 @@ function collapseSourcemaps(file, map, modules, bundleSourcemapChain, excludeCon
|
|
|
16832
16912
|
sourcesContent = (excludeContent ? null : sourcesContent);
|
|
16833
16913
|
return new SourceMap({ file, mappings, names, sources, sourcesContent });
|
|
16834
16914
|
}
|
|
16835
|
-
function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
|
|
16915
|
+
function collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log) {
|
|
16836
16916
|
if (sourcemapChain.length === 0) {
|
|
16837
16917
|
return originalSourcemap;
|
|
16838
16918
|
}
|
|
16839
|
-
const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(
|
|
16919
|
+
const source = getCollapsedSourcemap(id, originalCode, originalSourcemap, sourcemapChain, getLinkMap(log));
|
|
16840
16920
|
const map = source.traceMappings();
|
|
16841
16921
|
return { version: 3, ...map };
|
|
16842
16922
|
}
|
|
@@ -16861,14 +16941,14 @@ function decodedSourcemap(map) {
|
|
|
16861
16941
|
return { ...map, mappings };
|
|
16862
16942
|
}
|
|
16863
16943
|
|
|
16864
|
-
async function renderChunks(chunks, bundle, pluginDriver, outputOptions,
|
|
16944
|
+
async function renderChunks(chunks, bundle, pluginDriver, outputOptions, log) {
|
|
16865
16945
|
timeStart('render chunks', 2);
|
|
16866
16946
|
reserveEntryChunksInBundle(chunks);
|
|
16867
16947
|
const renderedChunks = await Promise.all(chunks.map(chunk => chunk.render()));
|
|
16868
16948
|
timeEnd('render chunks', 2);
|
|
16869
16949
|
timeStart('transform chunks', 2);
|
|
16870
16950
|
const chunkGraph = getChunkGraph(chunks);
|
|
16871
|
-
const { nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver,
|
|
16951
|
+
const { nonHashedChunksWithPlaceholders, renderedChunksByPlaceholder, hashDependenciesByPlaceholder } = await transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log);
|
|
16872
16952
|
const hashesByPlaceholder = generateFinalHashes(renderedChunksByPlaceholder, hashDependenciesByPlaceholder, bundle);
|
|
16873
16953
|
addChunksToBundle(renderedChunksByPlaceholder, hashesByPlaceholder, bundle, nonHashedChunksWithPlaceholders, pluginDriver, outputOptions);
|
|
16874
16954
|
timeEnd('transform chunks', 2);
|
|
@@ -16887,7 +16967,7 @@ function getChunkGraph(chunks) {
|
|
|
16887
16967
|
return [renderedChunkInfo.fileName, renderedChunkInfo];
|
|
16888
16968
|
}));
|
|
16889
16969
|
}
|
|
16890
|
-
async function transformChunk(magicString, fileName, usedModules, chunkGraph, options, outputPluginDriver,
|
|
16970
|
+
async function transformChunk(magicString, fileName, usedModules, chunkGraph, options, outputPluginDriver, log) {
|
|
16891
16971
|
let map = null;
|
|
16892
16972
|
const sourcemapChain = [];
|
|
16893
16973
|
let code = await outputPluginDriver.hookReduceArg0('renderChunk', [magicString.toString(), chunkGraph[fileName], options, { chunks: chunkGraph }], (code, result, plugin) => {
|
|
@@ -16918,13 +16998,13 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
16918
16998
|
else
|
|
16919
16999
|
resultingFile = resolve(fileName);
|
|
16920
17000
|
const decodedMap = magicString.generateDecodedMap({});
|
|
16921
|
-
map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources,
|
|
17001
|
+
map = collapseSourcemaps(resultingFile, decodedMap, usedModules, sourcemapChain, sourcemapExcludeSources, log);
|
|
16922
17002
|
for (let sourcesIndex = 0; sourcesIndex < map.sources.length; ++sourcesIndex) {
|
|
16923
17003
|
let sourcePath = map.sources[sourcesIndex];
|
|
16924
17004
|
const sourcemapPath = `${resultingFile}.map`;
|
|
16925
17005
|
const ignoreList = sourcemapIgnoreList(sourcePath, sourcemapPath);
|
|
16926
17006
|
if (typeof ignoreList !== 'boolean') {
|
|
16927
|
-
error(
|
|
17007
|
+
error(logFailedValidation('sourcemapIgnoreList function must return a boolean.'));
|
|
16928
17008
|
}
|
|
16929
17009
|
if (ignoreList) {
|
|
16930
17010
|
if (map.x_google_ignoreList === undefined) {
|
|
@@ -16937,7 +17017,7 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
16937
17017
|
if (sourcemapPathTransform) {
|
|
16938
17018
|
sourcePath = sourcemapPathTransform(sourcePath, sourcemapPath);
|
|
16939
17019
|
if (typeof sourcePath !== 'string') {
|
|
16940
|
-
error(
|
|
17020
|
+
error(logFailedValidation(`sourcemapPathTransform function must return a string.`));
|
|
16941
17021
|
}
|
|
16942
17022
|
}
|
|
16943
17023
|
map.sources[sourcesIndex] = normalize(sourcePath);
|
|
@@ -16949,7 +17029,7 @@ async function transformChunk(magicString, fileName, usedModules, chunkGraph, op
|
|
|
16949
17029
|
map
|
|
16950
17030
|
};
|
|
16951
17031
|
}
|
|
16952
|
-
async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver,
|
|
17032
|
+
async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGraph, outputOptions, pluginDriver, log) {
|
|
16953
17033
|
const nonHashedChunksWithPlaceholders = [];
|
|
16954
17034
|
const renderedChunksByPlaceholder = new Map();
|
|
16955
17035
|
const hashDependenciesByPlaceholder = new Map();
|
|
@@ -16962,7 +17042,7 @@ async function transformChunksAndGenerateContentHashes(renderedChunks, chunkGrap
|
|
|
16962
17042
|
const transformedChunk = {
|
|
16963
17043
|
chunk,
|
|
16964
17044
|
fileName,
|
|
16965
|
-
...(await transformChunk(magicString, fileName, usedModules, chunkGraph, outputOptions, pluginDriver,
|
|
17045
|
+
...(await transformChunk(magicString, fileName, usedModules, chunkGraph, outputOptions, pluginDriver, log))
|
|
16966
17046
|
};
|
|
16967
17047
|
const { code } = transformedChunk;
|
|
16968
17048
|
if (hashPlaceholder) {
|
|
@@ -17079,14 +17159,14 @@ class Bundle {
|
|
|
17079
17159
|
const getHashPlaceholder = getHashPlaceholderGenerator();
|
|
17080
17160
|
const chunks = await this.generateChunks(outputBundle, getHashPlaceholder);
|
|
17081
17161
|
if (chunks.length > 1) {
|
|
17082
|
-
validateOptionsForMultiChunkOutput(this.outputOptions, this.inputOptions.
|
|
17162
|
+
validateOptionsForMultiChunkOutput(this.outputOptions, this.inputOptions.onLog);
|
|
17083
17163
|
}
|
|
17084
17164
|
this.pluginDriver.setChunkInformation(this.facadeChunkByModule);
|
|
17085
17165
|
for (const chunk of chunks) {
|
|
17086
17166
|
chunk.generateExports();
|
|
17087
17167
|
}
|
|
17088
17168
|
timeEnd('generate chunks', 2);
|
|
17089
|
-
await renderChunks(chunks, outputBundle, this.pluginDriver, this.outputOptions, this.inputOptions.
|
|
17169
|
+
await renderChunks(chunks, outputBundle, this.pluginDriver, this.outputOptions, this.inputOptions.onLog);
|
|
17090
17170
|
}
|
|
17091
17171
|
catch (error_) {
|
|
17092
17172
|
await this.pluginDriver.hookParallel('renderError', [error_]);
|
|
@@ -17149,7 +17229,7 @@ class Bundle {
|
|
|
17149
17229
|
});
|
|
17150
17230
|
}
|
|
17151
17231
|
catch (error_) {
|
|
17152
|
-
this.inputOptions.
|
|
17232
|
+
this.inputOptions.onLog(LOGLEVEL_WARN, logChunkInvalid(file, error_));
|
|
17153
17233
|
}
|
|
17154
17234
|
}
|
|
17155
17235
|
}
|
|
@@ -17171,7 +17251,7 @@ class Bundle {
|
|
|
17171
17251
|
? [{ alias: null, modules: includedModules }]
|
|
17172
17252
|
: preserveModules
|
|
17173
17253
|
? includedModules.map(module => ({ alias: null, modules: [module] }))
|
|
17174
|
-
: getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize)) {
|
|
17254
|
+
: getChunkAssignments(this.graph.entryModules, manualChunkAliasByEntry, experimentalMinChunkSize, this.inputOptions.onLog)) {
|
|
17175
17255
|
sortByExecutionOrder(modules);
|
|
17176
17256
|
const chunk = new Chunk(modules, this.inputOptions, this.outputOptions, this.unsetOptions, this.pluginDriver, this.graph.modulesById, chunkByModule, externalChunkByModule, this.facadeChunkByModule, this.includedNamespaces, alias, getHashPlaceholder, bundle, inputBase, snippets);
|
|
17177
17257
|
chunks.push(chunk);
|
|
@@ -17186,15 +17266,15 @@ class Bundle {
|
|
|
17186
17266
|
return [...chunks, ...facades];
|
|
17187
17267
|
}
|
|
17188
17268
|
}
|
|
17189
|
-
function validateOptionsForMultiChunkOutput(outputOptions,
|
|
17269
|
+
function validateOptionsForMultiChunkOutput(outputOptions, log) {
|
|
17190
17270
|
if (outputOptions.format === 'umd' || outputOptions.format === 'iife')
|
|
17191
|
-
return error(
|
|
17271
|
+
return error(logInvalidOption('output.format', URL_OUTPUT_FORMAT, 'UMD and IIFE output formats are not supported for code-splitting builds', outputOptions.format));
|
|
17192
17272
|
if (typeof outputOptions.file === 'string')
|
|
17193
|
-
return error(
|
|
17273
|
+
return error(logInvalidOption('output.file', URL_OUTPUT_DIR, 'when building multiple chunks, the "output.dir" option must be used, not "output.file". To inline dynamic imports, set the "inlineDynamicImports" option'));
|
|
17194
17274
|
if (outputOptions.sourcemapFile)
|
|
17195
|
-
return error(
|
|
17275
|
+
return error(logInvalidOption('output.sourcemapFile', URL_OUTPUT_SOURCEMAPFILE, '"output.sourcemapFile" is only supported for single-file builds'));
|
|
17196
17276
|
if (!outputOptions.amd.autoId && outputOptions.amd.id)
|
|
17197
|
-
|
|
17277
|
+
log(LOGLEVEL_WARN, logInvalidOption('output.amd.id', URL_OUTPUT_AMD_ID, 'this option is only properly supported for single-file builds. Use "output.amd.autoId" and "output.amd.basePath" instead'));
|
|
17198
17278
|
}
|
|
17199
17279
|
function getIncludedModules(modulesById) {
|
|
17200
17280
|
const includedModules = [];
|
|
@@ -17227,7 +17307,7 @@ function getExternalChunkByModule(modulesById, outputOptions, inputBase) {
|
|
|
17227
17307
|
function addModuleToManualChunk(alias, module, manualChunkAliasByEntry) {
|
|
17228
17308
|
const existingAlias = manualChunkAliasByEntry.get(module);
|
|
17229
17309
|
if (typeof existingAlias === 'string' && existingAlias !== alias) {
|
|
17230
|
-
return error(
|
|
17310
|
+
return error(logCannotAssignModuleToChunk(module.id, alias, existingAlias));
|
|
17231
17311
|
}
|
|
17232
17312
|
manualChunkAliasByEntry.set(module, alias);
|
|
17233
17313
|
}
|
|
@@ -23011,9 +23091,9 @@ const NO_CACHE = {
|
|
|
23011
23091
|
function uncacheablePluginError(pluginName) {
|
|
23012
23092
|
if (pluginName.startsWith(ANONYMOUS_PLUGIN_PREFIX) ||
|
|
23013
23093
|
pluginName.startsWith(ANONYMOUS_OUTPUT_PLUGIN_PREFIX)) {
|
|
23014
|
-
return error(
|
|
23094
|
+
return error(logAnonymousPluginCache());
|
|
23015
23095
|
}
|
|
23016
|
-
return error(
|
|
23096
|
+
return error(logDuplicatePluginName(pluginName));
|
|
23017
23097
|
}
|
|
23018
23098
|
function getCacheForUncacheablePlugin(pluginName) {
|
|
23019
23099
|
return {
|
|
@@ -23032,7 +23112,154 @@ function getCacheForUncacheablePlugin(pluginName) {
|
|
|
23032
23112
|
};
|
|
23033
23113
|
}
|
|
23034
23114
|
|
|
23035
|
-
async function
|
|
23115
|
+
async function asyncFlatten(array) {
|
|
23116
|
+
do {
|
|
23117
|
+
array = (await Promise.all(array)).flat(Infinity);
|
|
23118
|
+
} while (array.some((v) => v?.then));
|
|
23119
|
+
return array;
|
|
23120
|
+
}
|
|
23121
|
+
|
|
23122
|
+
const getOnLog = (config, logLevel, printLog = defaultPrintLog) => {
|
|
23123
|
+
const { onwarn, onLog } = config;
|
|
23124
|
+
const defaultOnLog = getDefaultOnLog(printLog, onwarn);
|
|
23125
|
+
if (onLog) {
|
|
23126
|
+
const minimalPriority = logLevelPriority[logLevel];
|
|
23127
|
+
return (level, log) => onLog(level, addLogToString(log), (level, handledLog) => {
|
|
23128
|
+
if (level === LOGLEVEL_ERROR) {
|
|
23129
|
+
return error(normalizeLog(handledLog));
|
|
23130
|
+
}
|
|
23131
|
+
if (logLevelPriority[level] >= minimalPriority) {
|
|
23132
|
+
defaultOnLog(level, normalizeLog(handledLog));
|
|
23133
|
+
}
|
|
23134
|
+
});
|
|
23135
|
+
}
|
|
23136
|
+
return defaultOnLog;
|
|
23137
|
+
};
|
|
23138
|
+
const getDefaultOnLog = (printLog, onwarn) => onwarn
|
|
23139
|
+
? (level, log) => {
|
|
23140
|
+
if (level === LOGLEVEL_WARN) {
|
|
23141
|
+
onwarn(addLogToString(log), warning => printLog(LOGLEVEL_WARN, normalizeLog(warning)));
|
|
23142
|
+
}
|
|
23143
|
+
else {
|
|
23144
|
+
printLog(level, log);
|
|
23145
|
+
}
|
|
23146
|
+
}
|
|
23147
|
+
: printLog;
|
|
23148
|
+
const addLogToString = (log) => {
|
|
23149
|
+
Object.defineProperty(log, 'toString', {
|
|
23150
|
+
value: () => getExtendedLogMessage(log),
|
|
23151
|
+
writable: true
|
|
23152
|
+
});
|
|
23153
|
+
return log;
|
|
23154
|
+
};
|
|
23155
|
+
const normalizeLog = (log) => typeof log === 'string'
|
|
23156
|
+
? { message: log }
|
|
23157
|
+
: typeof log === 'function'
|
|
23158
|
+
? normalizeLog(log())
|
|
23159
|
+
: log;
|
|
23160
|
+
const getExtendedLogMessage = (log) => {
|
|
23161
|
+
let prefix = '';
|
|
23162
|
+
if (log.plugin) {
|
|
23163
|
+
prefix += `(${log.plugin} plugin) `;
|
|
23164
|
+
}
|
|
23165
|
+
if (log.loc) {
|
|
23166
|
+
prefix += `${relativeId(log.loc.file)} (${log.loc.line}:${log.loc.column}) `;
|
|
23167
|
+
}
|
|
23168
|
+
return prefix + log.message;
|
|
23169
|
+
};
|
|
23170
|
+
const defaultPrintLog = (level, log) => {
|
|
23171
|
+
const message = getExtendedLogMessage(log);
|
|
23172
|
+
switch (level) {
|
|
23173
|
+
case LOGLEVEL_WARN: {
|
|
23174
|
+
return console.warn(message);
|
|
23175
|
+
}
|
|
23176
|
+
case LOGLEVEL_DEBUG: {
|
|
23177
|
+
return console.debug(message);
|
|
23178
|
+
}
|
|
23179
|
+
default: {
|
|
23180
|
+
return console.info(message);
|
|
23181
|
+
}
|
|
23182
|
+
}
|
|
23183
|
+
};
|
|
23184
|
+
function warnUnknownOptions(passedOptions, validOptions, optionType, log, ignoredKeys = /$./) {
|
|
23185
|
+
const validOptionSet = new Set(validOptions);
|
|
23186
|
+
const unknownOptions = Object.keys(passedOptions).filter(key => !(validOptionSet.has(key) || ignoredKeys.test(key)));
|
|
23187
|
+
if (unknownOptions.length > 0) {
|
|
23188
|
+
log(LOGLEVEL_WARN, logUnknownOption(optionType, unknownOptions, [...validOptionSet].sort()));
|
|
23189
|
+
}
|
|
23190
|
+
}
|
|
23191
|
+
const treeshakePresets = {
|
|
23192
|
+
recommended: {
|
|
23193
|
+
annotations: true,
|
|
23194
|
+
correctVarValueBeforeDeclaration: false,
|
|
23195
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
23196
|
+
moduleSideEffects: () => true,
|
|
23197
|
+
propertyReadSideEffects: true,
|
|
23198
|
+
tryCatchDeoptimization: true,
|
|
23199
|
+
unknownGlobalSideEffects: false
|
|
23200
|
+
},
|
|
23201
|
+
safest: {
|
|
23202
|
+
annotations: true,
|
|
23203
|
+
correctVarValueBeforeDeclaration: true,
|
|
23204
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
23205
|
+
moduleSideEffects: () => true,
|
|
23206
|
+
propertyReadSideEffects: true,
|
|
23207
|
+
tryCatchDeoptimization: true,
|
|
23208
|
+
unknownGlobalSideEffects: true
|
|
23209
|
+
},
|
|
23210
|
+
smallest: {
|
|
23211
|
+
annotations: true,
|
|
23212
|
+
correctVarValueBeforeDeclaration: false,
|
|
23213
|
+
manualPureFunctions: EMPTY_ARRAY,
|
|
23214
|
+
moduleSideEffects: () => false,
|
|
23215
|
+
propertyReadSideEffects: false,
|
|
23216
|
+
tryCatchDeoptimization: false,
|
|
23217
|
+
unknownGlobalSideEffects: false
|
|
23218
|
+
}
|
|
23219
|
+
};
|
|
23220
|
+
const generatedCodePresets = {
|
|
23221
|
+
es2015: {
|
|
23222
|
+
arrowFunctions: true,
|
|
23223
|
+
constBindings: true,
|
|
23224
|
+
objectShorthand: true,
|
|
23225
|
+
reservedNamesAsProps: true,
|
|
23226
|
+
symbols: true
|
|
23227
|
+
},
|
|
23228
|
+
es5: {
|
|
23229
|
+
arrowFunctions: false,
|
|
23230
|
+
constBindings: false,
|
|
23231
|
+
objectShorthand: false,
|
|
23232
|
+
reservedNamesAsProps: true,
|
|
23233
|
+
symbols: false
|
|
23234
|
+
}
|
|
23235
|
+
};
|
|
23236
|
+
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
23237
|
+
const objectifyOptionWithPresets = (presets, optionName, urlSnippet, additionalValues) => (value) => {
|
|
23238
|
+
if (typeof value === 'string') {
|
|
23239
|
+
const preset = presets[value];
|
|
23240
|
+
if (preset) {
|
|
23241
|
+
return preset;
|
|
23242
|
+
}
|
|
23243
|
+
error(logInvalidOption(optionName, urlSnippet, `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
|
|
23244
|
+
}
|
|
23245
|
+
return objectifyOption(value);
|
|
23246
|
+
};
|
|
23247
|
+
const getOptionWithPreset = (value, presets, optionName, urlSnippet, additionalValues) => {
|
|
23248
|
+
const presetName = value?.preset;
|
|
23249
|
+
if (presetName) {
|
|
23250
|
+
const preset = presets[presetName];
|
|
23251
|
+
if (preset) {
|
|
23252
|
+
return { ...preset, ...value };
|
|
23253
|
+
}
|
|
23254
|
+
else {
|
|
23255
|
+
error(logInvalidOption(`${optionName}.preset`, urlSnippet, `valid values are ${printQuotedStringList(Object.keys(presets))}`, presetName));
|
|
23256
|
+
}
|
|
23257
|
+
}
|
|
23258
|
+
return objectifyOptionWithPresets(presets, optionName, urlSnippet, additionalValues)(value);
|
|
23259
|
+
};
|
|
23260
|
+
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
23261
|
+
|
|
23262
|
+
async function transform(source, module, pluginDriver, log) {
|
|
23036
23263
|
const id = module.id;
|
|
23037
23264
|
const sourcemapChain = [];
|
|
23038
23265
|
let originalSourcemap = source.map === null ? null : decodedSourcemap(source.map);
|
|
@@ -23054,7 +23281,7 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
23054
23281
|
module.updateOptions(result);
|
|
23055
23282
|
if (result.code == null) {
|
|
23056
23283
|
if (result.map || result.ast) {
|
|
23057
|
-
|
|
23284
|
+
log(LOGLEVEL_WARN, logNoTransformMapOrAstWithoutCode(plugin.name));
|
|
23058
23285
|
}
|
|
23059
23286
|
return previousCode;
|
|
23060
23287
|
}
|
|
@@ -23073,6 +23300,14 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
23073
23300
|
}
|
|
23074
23301
|
return code;
|
|
23075
23302
|
}
|
|
23303
|
+
const getLogHandler = (handler) => (log, pos) => {
|
|
23304
|
+
log = normalizeLog(log);
|
|
23305
|
+
if (pos)
|
|
23306
|
+
augmentCodeLocation(log, pos, currentSource, id);
|
|
23307
|
+
log.id = id;
|
|
23308
|
+
log.hook = 'transform';
|
|
23309
|
+
handler(log);
|
|
23310
|
+
};
|
|
23076
23311
|
let code;
|
|
23077
23312
|
try {
|
|
23078
23313
|
code = await pluginDriver.hookReduceArg0('transform', [currentSource, id], transformReducer, (pluginContext, plugin) => {
|
|
@@ -23086,6 +23321,7 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
23086
23321
|
cache: customTransformCache
|
|
23087
23322
|
? pluginContext.cache
|
|
23088
23323
|
: getTrackedPluginCache(pluginContext.cache, useCustomTransformCache),
|
|
23324
|
+
debug: getLogHandler(pluginContext.debug),
|
|
23089
23325
|
emitFile(emittedFile) {
|
|
23090
23326
|
emittedFiles.push(emittedFile);
|
|
23091
23327
|
return pluginDriver.emitFile(emittedFile);
|
|
@@ -23100,7 +23336,7 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
23100
23336
|
return pluginContext.error(error_);
|
|
23101
23337
|
},
|
|
23102
23338
|
getCombinedSourcemap() {
|
|
23103
|
-
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain,
|
|
23339
|
+
const combinedMap = collapseSourcemap(id, originalCode, originalSourcemap, sourcemapChain, log);
|
|
23104
23340
|
if (!combinedMap) {
|
|
23105
23341
|
const magicString = new MagicString(originalCode);
|
|
23106
23342
|
return magicString.generateMap({ hires: true, includeContent: true, source: id });
|
|
@@ -23115,23 +23351,16 @@ async function transform(source, module, pluginDriver, warn) {
|
|
|
23115
23351
|
sourcesContent: combinedMap.sourcesContent
|
|
23116
23352
|
});
|
|
23117
23353
|
},
|
|
23354
|
+
info: getLogHandler(pluginContext.info),
|
|
23118
23355
|
setAssetSource() {
|
|
23119
|
-
return this.error(
|
|
23356
|
+
return this.error(logInvalidSetAssetSourceCall());
|
|
23120
23357
|
},
|
|
23121
|
-
warn(
|
|
23122
|
-
if (typeof warning === 'string')
|
|
23123
|
-
warning = { message: warning };
|
|
23124
|
-
if (pos)
|
|
23125
|
-
augmentCodeLocation(warning, pos, currentSource, id);
|
|
23126
|
-
warning.id = id;
|
|
23127
|
-
warning.hook = 'transform';
|
|
23128
|
-
pluginContext.warn(warning);
|
|
23129
|
-
}
|
|
23358
|
+
warn: getLogHandler(pluginContext.warn)
|
|
23130
23359
|
};
|
|
23131
23360
|
});
|
|
23132
23361
|
}
|
|
23133
23362
|
catch (error_) {
|
|
23134
|
-
return error(
|
|
23363
|
+
return error(logPluginError(error_, pluginName, { hook: 'transform', id }));
|
|
23135
23364
|
}
|
|
23136
23365
|
if (!customTransformCache && // files emitted by a transform hook need to be emitted again if the hook is skipped
|
|
23137
23366
|
emittedFiles.length > 0)
|
|
@@ -23257,7 +23486,7 @@ class ModuleLoader {
|
|
|
23257
23486
|
? { code: source }
|
|
23258
23487
|
: source != null && typeof source === 'object' && typeof source.code === 'string'
|
|
23259
23488
|
? source
|
|
23260
|
-
: error(
|
|
23489
|
+
: error(logBadLoader(id));
|
|
23261
23490
|
const cachedModule = this.graph.cachedModules.get(id);
|
|
23262
23491
|
if (cachedModule &&
|
|
23263
23492
|
!cachedModule.customTransformCache &&
|
|
@@ -23281,7 +23510,7 @@ class ModuleLoader {
|
|
|
23281
23510
|
}
|
|
23282
23511
|
else {
|
|
23283
23512
|
module.updateOptions(sourceDescription);
|
|
23284
|
-
module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.
|
|
23513
|
+
module.setSource(await transform(sourceDescription, module, this.pluginDriver, this.options.onLog));
|
|
23285
23514
|
}
|
|
23286
23515
|
}
|
|
23287
23516
|
async awaitLoadModulesPromise() {
|
|
@@ -23327,7 +23556,7 @@ class ModuleLoader {
|
|
|
23327
23556
|
const existingModule = this.modulesById.get(id);
|
|
23328
23557
|
if (existingModule instanceof Module) {
|
|
23329
23558
|
if (importer && doAssertionsDiffer(assertions, existingModule.info.assertions)) {
|
|
23330
|
-
this.options.
|
|
23559
|
+
this.options.onLog(LOGLEVEL_WARN, logInconsistentImportAssertions(existingModule.info.assertions, assertions, id, importer));
|
|
23331
23560
|
}
|
|
23332
23561
|
await this.handleExistingModule(existingModule, isEntry, isPreload);
|
|
23333
23562
|
return existingModule;
|
|
@@ -23376,10 +23605,10 @@ class ModuleLoader {
|
|
|
23376
23605
|
this.modulesById.set(id, externalModule);
|
|
23377
23606
|
}
|
|
23378
23607
|
else if (!(externalModule instanceof ExternalModule)) {
|
|
23379
|
-
return error(
|
|
23608
|
+
return error(logInternalIdCannotBeExternal(source, importer));
|
|
23380
23609
|
}
|
|
23381
23610
|
else if (doAssertionsDiffer(externalModule.info.assertions, assertions)) {
|
|
23382
|
-
this.options.
|
|
23611
|
+
this.options.onLog(LOGLEVEL_WARN, logInconsistentImportAssertions(externalModule.info.assertions, assertions, source, importer));
|
|
23383
23612
|
}
|
|
23384
23613
|
return Promise.resolve(externalModule);
|
|
23385
23614
|
}
|
|
@@ -23489,9 +23718,9 @@ class ModuleLoader {
|
|
|
23489
23718
|
handleInvalidResolvedId(resolvedId, source, importer, assertions) {
|
|
23490
23719
|
if (resolvedId === null) {
|
|
23491
23720
|
if (isRelative(source)) {
|
|
23492
|
-
return error(
|
|
23721
|
+
return error(logUnresolvedImport(source, importer));
|
|
23493
23722
|
}
|
|
23494
|
-
this.options.
|
|
23723
|
+
this.options.onLog(LOGLEVEL_WARN, logUnresolvedImportTreatedAsExternal(source, importer));
|
|
23495
23724
|
return {
|
|
23496
23725
|
assertions,
|
|
23497
23726
|
external: true,
|
|
@@ -23503,7 +23732,7 @@ class ModuleLoader {
|
|
|
23503
23732
|
};
|
|
23504
23733
|
}
|
|
23505
23734
|
else if (resolvedId.external && resolvedId.syntheticNamedExports) {
|
|
23506
|
-
this.options.
|
|
23735
|
+
this.options.onLog(LOGLEVEL_WARN, logExternalSyntheticExports(source, importer));
|
|
23507
23736
|
}
|
|
23508
23737
|
return resolvedId;
|
|
23509
23738
|
}
|
|
@@ -23511,14 +23740,14 @@ class ModuleLoader {
|
|
|
23511
23740
|
const resolveIdResult = await resolveId(unresolvedId, importer, this.options.preserveSymlinks, this.pluginDriver, this.resolveId, null, EMPTY_OBJECT, true, EMPTY_OBJECT);
|
|
23512
23741
|
if (resolveIdResult == null) {
|
|
23513
23742
|
return error(implicitlyLoadedBefore === null
|
|
23514
|
-
?
|
|
23515
|
-
:
|
|
23743
|
+
? logUnresolvedEntry(unresolvedId)
|
|
23744
|
+
: logUnresolvedImplicitDependant(unresolvedId, implicitlyLoadedBefore));
|
|
23516
23745
|
}
|
|
23517
23746
|
if (resolveIdResult === false ||
|
|
23518
23747
|
(typeof resolveIdResult === 'object' && resolveIdResult.external)) {
|
|
23519
23748
|
return error(implicitlyLoadedBefore === null
|
|
23520
|
-
?
|
|
23521
|
-
:
|
|
23749
|
+
? logEntryCannotBeExternal(unresolvedId)
|
|
23750
|
+
: logImplicitDependantCannotBeExternal(unresolvedId, implicitlyLoadedBefore));
|
|
23522
23751
|
}
|
|
23523
23752
|
return this.fetchModule(this.getResolvedIdWithDefaults(typeof resolveIdResult === 'object'
|
|
23524
23753
|
? resolveIdResult
|
|
@@ -23543,7 +23772,7 @@ class ModuleLoader {
|
|
|
23543
23772
|
const existingResolution = module.resolvedIds[specifier];
|
|
23544
23773
|
if (existingResolution) {
|
|
23545
23774
|
if (doAssertionsDiffer(existingResolution.assertions, assertions)) {
|
|
23546
|
-
this.options.
|
|
23775
|
+
this.options.onLog(LOGLEVEL_WARN, logInconsistentImportAssertions(existingResolution.assertions, assertions, specifier, importer));
|
|
23547
23776
|
}
|
|
23548
23777
|
return existingResolution;
|
|
23549
23778
|
}
|
|
@@ -23611,9 +23840,9 @@ function generateAssetFileName(name, source, sourceHash, outputOptions, bundle)
|
|
|
23611
23840
|
name: () => emittedName.slice(0, Math.max(0, emittedName.length - extname(emittedName).length))
|
|
23612
23841
|
}), bundle);
|
|
23613
23842
|
}
|
|
23614
|
-
function reserveFileNameInBundle(fileName, { bundle },
|
|
23843
|
+
function reserveFileNameInBundle(fileName, { bundle }, log) {
|
|
23615
23844
|
if (bundle[lowercaseBundleKeys].has(fileName.toLowerCase())) {
|
|
23616
|
-
|
|
23845
|
+
log(LOGLEVEL_WARN, logFileNameConflict(fileName));
|
|
23617
23846
|
}
|
|
23618
23847
|
else {
|
|
23619
23848
|
bundle[fileName] = FILE_PLACEHOLDER;
|
|
@@ -23631,13 +23860,13 @@ function hasValidName(emittedFile) {
|
|
|
23631
23860
|
function getValidSource(source, emittedFile, fileReferenceId) {
|
|
23632
23861
|
if (!(typeof source === 'string' || source instanceof Uint8Array)) {
|
|
23633
23862
|
const assetName = emittedFile.fileName || emittedFile.name || fileReferenceId;
|
|
23634
|
-
return error(
|
|
23863
|
+
return error(logFailedValidation(`Could not set source for ${typeof assetName === 'string' ? `asset "${assetName}"` : 'unnamed asset'}, asset source needs to be a string, Uint8Array or Buffer.`));
|
|
23635
23864
|
}
|
|
23636
23865
|
return source;
|
|
23637
23866
|
}
|
|
23638
23867
|
function getAssetFileName(file, referenceId) {
|
|
23639
23868
|
if (typeof file.fileName !== 'string') {
|
|
23640
|
-
return error(
|
|
23869
|
+
return error(logAssetNotFinalisedForFileName(file.name || referenceId));
|
|
23641
23870
|
}
|
|
23642
23871
|
return file.fileName;
|
|
23643
23872
|
}
|
|
@@ -23648,7 +23877,7 @@ function getChunkFileName(file, facadeChunkByModule) {
|
|
|
23648
23877
|
if (facadeChunkByModule) {
|
|
23649
23878
|
return facadeChunkByModule.get(file.module).getFileName();
|
|
23650
23879
|
}
|
|
23651
|
-
return error(
|
|
23880
|
+
return error(logChunkNotGeneratedForFileName(file.fileName || file.name));
|
|
23652
23881
|
}
|
|
23653
23882
|
class FileEmitter {
|
|
23654
23883
|
constructor(graph, options, baseFileEmitter) {
|
|
@@ -23660,13 +23889,13 @@ class FileEmitter {
|
|
|
23660
23889
|
this.outputFileEmitters = [];
|
|
23661
23890
|
this.emitFile = (emittedFile) => {
|
|
23662
23891
|
if (!hasValidType(emittedFile)) {
|
|
23663
|
-
return error(
|
|
23892
|
+
return error(logFailedValidation(`Emitted files must be of type "asset", "chunk" or "prebuilt-chunk", received "${emittedFile && emittedFile.type}".`));
|
|
23664
23893
|
}
|
|
23665
23894
|
if (emittedFile.type === 'prebuilt-chunk') {
|
|
23666
23895
|
return this.emitPrebuiltChunk(emittedFile);
|
|
23667
23896
|
}
|
|
23668
23897
|
if (!hasValidName(emittedFile)) {
|
|
23669
|
-
return error(
|
|
23898
|
+
return error(logFailedValidation(`The "fileName" or "name" properties of emitted chunks and assets must be strings that are neither absolute nor relative paths, received "${emittedFile.fileName || emittedFile.name}".`));
|
|
23670
23899
|
}
|
|
23671
23900
|
if (emittedFile.type === 'chunk') {
|
|
23672
23901
|
return this.emitChunk(emittedFile);
|
|
@@ -23676,13 +23905,13 @@ class FileEmitter {
|
|
|
23676
23905
|
this.finaliseAssets = () => {
|
|
23677
23906
|
for (const [referenceId, emittedFile] of this.filesByReferenceId) {
|
|
23678
23907
|
if (emittedFile.type === 'asset' && typeof emittedFile.fileName !== 'string')
|
|
23679
|
-
return error(
|
|
23908
|
+
return error(logNoAssetSourceSet(emittedFile.name || referenceId));
|
|
23680
23909
|
}
|
|
23681
23910
|
};
|
|
23682
23911
|
this.getFileName = (fileReferenceId) => {
|
|
23683
23912
|
const emittedFile = this.filesByReferenceId.get(fileReferenceId);
|
|
23684
23913
|
if (!emittedFile)
|
|
23685
|
-
return error(
|
|
23914
|
+
return error(logFileReferenceIdNotFoundForFilename(fileReferenceId));
|
|
23686
23915
|
if (emittedFile.type === 'chunk') {
|
|
23687
23916
|
return getChunkFileName(emittedFile, this.facadeChunkByModule);
|
|
23688
23917
|
}
|
|
@@ -23694,12 +23923,12 @@ class FileEmitter {
|
|
|
23694
23923
|
this.setAssetSource = (referenceId, requestedSource) => {
|
|
23695
23924
|
const consumedFile = this.filesByReferenceId.get(referenceId);
|
|
23696
23925
|
if (!consumedFile)
|
|
23697
|
-
return error(
|
|
23926
|
+
return error(logAssetReferenceIdNotFoundForSetSource(referenceId));
|
|
23698
23927
|
if (consumedFile.type !== 'asset') {
|
|
23699
|
-
return error(
|
|
23928
|
+
return error(logFailedValidation(`Asset sources can only be set for emitted assets but "${referenceId}" is an emitted chunk.`));
|
|
23700
23929
|
}
|
|
23701
23930
|
if (consumedFile.source !== undefined) {
|
|
23702
|
-
return error(
|
|
23931
|
+
return error(logAssetSourceAlreadySet(consumedFile.name || referenceId));
|
|
23703
23932
|
}
|
|
23704
23933
|
const source = getValidSource(requestedSource, consumedFile, referenceId);
|
|
23705
23934
|
if (this.output) {
|
|
@@ -23723,7 +23952,7 @@ class FileEmitter {
|
|
|
23723
23952
|
});
|
|
23724
23953
|
for (const emittedFile of this.filesByReferenceId.values()) {
|
|
23725
23954
|
if (emittedFile.fileName) {
|
|
23726
|
-
reserveFileNameInBundle(emittedFile.fileName, output, this.options.
|
|
23955
|
+
reserveFileNameInBundle(emittedFile.fileName, output, this.options.onLog);
|
|
23727
23956
|
}
|
|
23728
23957
|
}
|
|
23729
23958
|
const consumedAssetsByHash = new Map();
|
|
@@ -23813,7 +24042,7 @@ class FileEmitter {
|
|
|
23813
24042
|
emitAssetWithReferenceId(consumedAsset, output) {
|
|
23814
24043
|
const { fileName, source } = consumedAsset;
|
|
23815
24044
|
if (fileName) {
|
|
23816
|
-
reserveFileNameInBundle(fileName, output, this.options.
|
|
24045
|
+
reserveFileNameInBundle(fileName, output, this.options.onLog);
|
|
23817
24046
|
}
|
|
23818
24047
|
if (source !== undefined) {
|
|
23819
24048
|
this.finalizeAdditionalAsset(consumedAsset, source, output);
|
|
@@ -23821,10 +24050,10 @@ class FileEmitter {
|
|
|
23821
24050
|
}
|
|
23822
24051
|
emitChunk(emittedChunk) {
|
|
23823
24052
|
if (this.graph.phase > BuildPhase.LOAD_AND_PARSE) {
|
|
23824
|
-
return error(
|
|
24053
|
+
return error(logInvalidRollupPhaseForChunkEmission());
|
|
23825
24054
|
}
|
|
23826
24055
|
if (typeof emittedChunk.id !== 'string') {
|
|
23827
|
-
return error(
|
|
24056
|
+
return error(logFailedValidation(`Emitted chunks need to have a valid string id, received "${emittedChunk.id}"`));
|
|
23828
24057
|
}
|
|
23829
24058
|
const consumedChunk = {
|
|
23830
24059
|
fileName: emittedChunk.fileName,
|
|
@@ -23844,11 +24073,11 @@ class FileEmitter {
|
|
|
23844
24073
|
}
|
|
23845
24074
|
emitPrebuiltChunk(emitPrebuiltChunk) {
|
|
23846
24075
|
if (typeof emitPrebuiltChunk.code !== 'string') {
|
|
23847
|
-
return error(
|
|
24076
|
+
return error(logFailedValidation(`Emitted prebuilt chunks need to have a valid string code, received "${emitPrebuiltChunk.code}".`));
|
|
23848
24077
|
}
|
|
23849
24078
|
if (typeof emitPrebuiltChunk.fileName !== 'string' ||
|
|
23850
24079
|
isPathFragment(emitPrebuiltChunk.fileName)) {
|
|
23851
|
-
return error(
|
|
24080
|
+
return error(logFailedValidation(`The "fileName" property of emitted prebuilt chunks must be strings that are neither absolute nor relative paths, received "${emitPrebuiltChunk.fileName}".`));
|
|
23852
24081
|
}
|
|
23853
24082
|
const consumedPrebuiltChunk = {
|
|
23854
24083
|
code: emitPrebuiltChunk.code,
|
|
@@ -23923,7 +24152,26 @@ class FileEmitter {
|
|
|
23923
24152
|
}
|
|
23924
24153
|
}
|
|
23925
24154
|
|
|
24155
|
+
function getLogHandler(level, code, logger, pluginName, logLevel) {
|
|
24156
|
+
if (logLevelPriority[level] < logLevelPriority[logLevel]) {
|
|
24157
|
+
return doNothing;
|
|
24158
|
+
}
|
|
24159
|
+
return (log, pos) => {
|
|
24160
|
+
if (pos != null) {
|
|
24161
|
+
logger(LOGLEVEL_WARN, logInvalidLogPosition(pluginName));
|
|
24162
|
+
}
|
|
24163
|
+
log = normalizeLog(log);
|
|
24164
|
+
if (log.code && !log.pluginCode) {
|
|
24165
|
+
log.pluginCode = log.code;
|
|
24166
|
+
}
|
|
24167
|
+
log.code = code;
|
|
24168
|
+
log.plugin = pluginName;
|
|
24169
|
+
logger(level, log);
|
|
24170
|
+
};
|
|
24171
|
+
}
|
|
24172
|
+
|
|
23926
24173
|
function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, existingPluginNames) {
|
|
24174
|
+
const { logLevel, onLog } = options;
|
|
23927
24175
|
let cacheable = true;
|
|
23928
24176
|
if (typeof plugin.cacheKey !== 'string') {
|
|
23929
24177
|
if (plugin.name.startsWith(ANONYMOUS_PLUGIN_PREFIX) ||
|
|
@@ -23949,19 +24197,21 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
23949
24197
|
return {
|
|
23950
24198
|
addWatchFile(id) {
|
|
23951
24199
|
if (graph.phase >= BuildPhase.GENERATE) {
|
|
23952
|
-
return this.error(
|
|
24200
|
+
return this.error(logInvalidRollupPhaseForAddWatchFile());
|
|
23953
24201
|
}
|
|
23954
24202
|
graph.watchFiles[id] = true;
|
|
23955
24203
|
},
|
|
23956
24204
|
cache: cacheInstance,
|
|
24205
|
+
debug: getLogHandler(LOGLEVEL_DEBUG, 'PLUGIN_LOG', onLog, plugin.name, logLevel),
|
|
23957
24206
|
emitFile: fileEmitter.emitFile.bind(fileEmitter),
|
|
23958
24207
|
error(error_) {
|
|
23959
|
-
return error(
|
|
24208
|
+
return error(logPluginError(normalizeLog(error_), plugin.name));
|
|
23960
24209
|
},
|
|
23961
24210
|
getFileName: fileEmitter.getFileName,
|
|
23962
24211
|
getModuleIds: () => graph.modulesById.keys(),
|
|
23963
24212
|
getModuleInfo: graph.getModuleInfo,
|
|
23964
24213
|
getWatchFiles: () => Object.keys(graph.watchFiles),
|
|
24214
|
+
info: getLogHandler(LOGLEVEL_INFO, 'PLUGIN_LOG', onLog, plugin.name, logLevel),
|
|
23965
24215
|
load(resolvedId) {
|
|
23966
24216
|
return graph.moduleLoader.preloadModule(resolvedId);
|
|
23967
24217
|
},
|
|
@@ -23983,15 +24233,7 @@ function getPluginContext(plugin, pluginCache, graph, options, fileEmitter, exis
|
|
|
23983
24233
|
return graph.moduleLoader.resolveId(source, importer, custom, isEntry, assertions || EMPTY_OBJECT, skipSelf ? [{ importer, plugin, source }] : null);
|
|
23984
24234
|
},
|
|
23985
24235
|
setAssetSource: fileEmitter.setAssetSource,
|
|
23986
|
-
warn(
|
|
23987
|
-
if (typeof warning === 'string')
|
|
23988
|
-
warning = { message: warning };
|
|
23989
|
-
if (warning.code)
|
|
23990
|
-
warning.pluginCode = warning.code;
|
|
23991
|
-
warning.code = 'PLUGIN_WARNING';
|
|
23992
|
-
warning.plugin = plugin.name;
|
|
23993
|
-
options.onwarn(warning);
|
|
23994
|
-
}
|
|
24236
|
+
warn: getLogHandler(LOGLEVEL_WARN, 'PLUGIN_WARNING', onLog, plugin.name, logLevel)
|
|
23995
24237
|
};
|
|
23996
24238
|
}
|
|
23997
24239
|
|
|
@@ -24003,6 +24245,7 @@ const inputHookNames = {
|
|
|
24003
24245
|
closeWatcher: 1,
|
|
24004
24246
|
load: 1,
|
|
24005
24247
|
moduleParsed: 1,
|
|
24248
|
+
onLog: 1,
|
|
24006
24249
|
options: 1,
|
|
24007
24250
|
resolveDynamicImport: 1,
|
|
24008
24251
|
resolveId: 1,
|
|
@@ -24034,7 +24277,7 @@ class PluginDriver {
|
|
|
24034
24277
|
for (const plugin of userPlugins) {
|
|
24035
24278
|
for (const hook of inputHooks) {
|
|
24036
24279
|
if (hook in plugin) {
|
|
24037
|
-
options.
|
|
24280
|
+
options.onLog(LOGLEVEL_WARN, logInputHookInOutputPlugin(plugin.name, hook));
|
|
24038
24281
|
}
|
|
24039
24282
|
}
|
|
24040
24283
|
}
|
|
@@ -24181,7 +24424,7 @@ class PluginDriver {
|
|
|
24181
24424
|
// action considered to be fulfilled since error being handled
|
|
24182
24425
|
this.unfulfilledActions.delete(action);
|
|
24183
24426
|
}
|
|
24184
|
-
return error(
|
|
24427
|
+
return error(logPluginError(error_, plugin.name, { hook: hookName }));
|
|
24185
24428
|
});
|
|
24186
24429
|
}
|
|
24187
24430
|
/**
|
|
@@ -24203,7 +24446,7 @@ class PluginDriver {
|
|
|
24203
24446
|
return handler.apply(context, parameters);
|
|
24204
24447
|
}
|
|
24205
24448
|
catch (error_) {
|
|
24206
|
-
return error(
|
|
24449
|
+
return error(logPluginError(error_, plugin.name, { hook: hookName }));
|
|
24207
24450
|
}
|
|
24208
24451
|
}
|
|
24209
24452
|
}
|
|
@@ -24235,12 +24478,12 @@ function getSortedValidatedPlugins(hookName, plugins, validateHandler = validate
|
|
|
24235
24478
|
}
|
|
24236
24479
|
function validateFunctionPluginHandler(handler, hookName, plugin) {
|
|
24237
24480
|
if (typeof handler !== 'function') {
|
|
24238
|
-
error(
|
|
24481
|
+
error(logInvalidFunctionPluginHook(hookName, plugin.name));
|
|
24239
24482
|
}
|
|
24240
24483
|
}
|
|
24241
24484
|
function validateAddonPluginHandler(handler, hookName, plugin) {
|
|
24242
24485
|
if (typeof handler !== 'string' && typeof handler !== 'function') {
|
|
24243
|
-
return error(
|
|
24486
|
+
return error(logInvalidAddonPluginHook(hookName, plugin.name));
|
|
24244
24487
|
}
|
|
24245
24488
|
}
|
|
24246
24489
|
function noReturn() { }
|
|
@@ -24452,7 +24695,7 @@ class Graph {
|
|
|
24452
24695
|
for (const module of this.implicitEntryModules) {
|
|
24453
24696
|
for (const dependant of module.implicitlyLoadedAfter) {
|
|
24454
24697
|
if (!(dependant.info.isEntry || dependant.isIncluded())) {
|
|
24455
|
-
error(
|
|
24698
|
+
error(logImplicitDependantIsNotIncluded(dependant));
|
|
24456
24699
|
}
|
|
24457
24700
|
}
|
|
24458
24701
|
}
|
|
@@ -24460,7 +24703,7 @@ class Graph {
|
|
|
24460
24703
|
sortModules() {
|
|
24461
24704
|
const { orderedModules, cyclePaths } = analyseModuleExecution(this.entryModules);
|
|
24462
24705
|
for (const cyclePath of cyclePaths) {
|
|
24463
|
-
this.options.
|
|
24706
|
+
this.options.onLog(LOGLEVEL_WARN, logCircularDependency(cyclePath));
|
|
24464
24707
|
}
|
|
24465
24708
|
this.modules = orderedModules;
|
|
24466
24709
|
for (const module of this.modules) {
|
|
@@ -24473,7 +24716,7 @@ class Graph {
|
|
|
24473
24716
|
for (const importDescription of module.importDescriptions.values()) {
|
|
24474
24717
|
if (importDescription.name !== '*' &&
|
|
24475
24718
|
!importDescription.module.getVariableForExportName(importDescription.name)[0]) {
|
|
24476
|
-
module.
|
|
24719
|
+
module.log(LOGLEVEL_WARN, logMissingExport(importDescription.name, module.id, importDescription.module.id), importDescription.start);
|
|
24477
24720
|
}
|
|
24478
24721
|
}
|
|
24479
24722
|
}
|
|
@@ -24532,6 +24775,40 @@ async function catchUnfinishedHookActions(pluginDriver, callback) {
|
|
|
24532
24775
|
}
|
|
24533
24776
|
}
|
|
24534
24777
|
|
|
24778
|
+
function getLogger(plugins, onLog, watchMode, logLevel) {
|
|
24779
|
+
plugins = getSortedValidatedPlugins('onLog', plugins);
|
|
24780
|
+
const minimalPriority = logLevelPriority[logLevel];
|
|
24781
|
+
const logger = (level, log, skipped = EMPTY_SET) => {
|
|
24782
|
+
const logPriority = logLevelPriority[level];
|
|
24783
|
+
if (logPriority < minimalPriority) {
|
|
24784
|
+
return;
|
|
24785
|
+
}
|
|
24786
|
+
for (const plugin of plugins) {
|
|
24787
|
+
if (skipped.has(plugin))
|
|
24788
|
+
continue;
|
|
24789
|
+
const { onLog: pluginOnLog } = plugin;
|
|
24790
|
+
const getLogHandler = (level) => {
|
|
24791
|
+
if (logLevelPriority[level] < minimalPriority) {
|
|
24792
|
+
return doNothing;
|
|
24793
|
+
}
|
|
24794
|
+
return log => logger(level, normalizeLog(log), new Set(skipped).add(plugin));
|
|
24795
|
+
};
|
|
24796
|
+
const handler = 'handler' in pluginOnLog ? pluginOnLog.handler : pluginOnLog;
|
|
24797
|
+
if (handler.call({
|
|
24798
|
+
debug: getLogHandler(LOGLEVEL_DEBUG),
|
|
24799
|
+
error: (log) => error(normalizeLog(log)),
|
|
24800
|
+
info: getLogHandler(LOGLEVEL_INFO),
|
|
24801
|
+
meta: { rollupVersion: version$1, watchMode },
|
|
24802
|
+
warn: getLogHandler(LOGLEVEL_WARN)
|
|
24803
|
+
}, level, log) === false) {
|
|
24804
|
+
return;
|
|
24805
|
+
}
|
|
24806
|
+
}
|
|
24807
|
+
onLog(level, log);
|
|
24808
|
+
};
|
|
24809
|
+
return logger;
|
|
24810
|
+
}
|
|
24811
|
+
|
|
24535
24812
|
const leftCurlyBrace = "{".charCodeAt(0);
|
|
24536
24813
|
const space = " ".charCodeAt(0);
|
|
24537
24814
|
|
|
@@ -24783,100 +25060,16 @@ function ensureArray(items) {
|
|
|
24783
25060
|
return [];
|
|
24784
25061
|
}
|
|
24785
25062
|
|
|
24786
|
-
async function
|
|
24787
|
-
do {
|
|
24788
|
-
array = (await Promise.all(array)).flat(Infinity);
|
|
24789
|
-
} while (array.some((v) => v?.then));
|
|
24790
|
-
return array;
|
|
24791
|
-
}
|
|
24792
|
-
|
|
24793
|
-
const defaultOnWarn = warning => console.warn(warning.message || warning);
|
|
24794
|
-
function warnUnknownOptions(passedOptions, validOptions, optionType, warn, ignoredKeys = /$./) {
|
|
24795
|
-
const validOptionSet = new Set(validOptions);
|
|
24796
|
-
const unknownOptions = Object.keys(passedOptions).filter(key => !(validOptionSet.has(key) || ignoredKeys.test(key)));
|
|
24797
|
-
if (unknownOptions.length > 0) {
|
|
24798
|
-
warn(errorUnknownOption(optionType, unknownOptions, [...validOptionSet].sort()));
|
|
24799
|
-
}
|
|
24800
|
-
}
|
|
24801
|
-
const treeshakePresets = {
|
|
24802
|
-
recommended: {
|
|
24803
|
-
annotations: true,
|
|
24804
|
-
correctVarValueBeforeDeclaration: false,
|
|
24805
|
-
manualPureFunctions: EMPTY_ARRAY,
|
|
24806
|
-
moduleSideEffects: () => true,
|
|
24807
|
-
propertyReadSideEffects: true,
|
|
24808
|
-
tryCatchDeoptimization: true,
|
|
24809
|
-
unknownGlobalSideEffects: false
|
|
24810
|
-
},
|
|
24811
|
-
safest: {
|
|
24812
|
-
annotations: true,
|
|
24813
|
-
correctVarValueBeforeDeclaration: true,
|
|
24814
|
-
manualPureFunctions: EMPTY_ARRAY,
|
|
24815
|
-
moduleSideEffects: () => true,
|
|
24816
|
-
propertyReadSideEffects: true,
|
|
24817
|
-
tryCatchDeoptimization: true,
|
|
24818
|
-
unknownGlobalSideEffects: true
|
|
24819
|
-
},
|
|
24820
|
-
smallest: {
|
|
24821
|
-
annotations: true,
|
|
24822
|
-
correctVarValueBeforeDeclaration: false,
|
|
24823
|
-
manualPureFunctions: EMPTY_ARRAY,
|
|
24824
|
-
moduleSideEffects: () => false,
|
|
24825
|
-
propertyReadSideEffects: false,
|
|
24826
|
-
tryCatchDeoptimization: false,
|
|
24827
|
-
unknownGlobalSideEffects: false
|
|
24828
|
-
}
|
|
24829
|
-
};
|
|
24830
|
-
const generatedCodePresets = {
|
|
24831
|
-
es2015: {
|
|
24832
|
-
arrowFunctions: true,
|
|
24833
|
-
constBindings: true,
|
|
24834
|
-
objectShorthand: true,
|
|
24835
|
-
reservedNamesAsProps: true,
|
|
24836
|
-
symbols: true
|
|
24837
|
-
},
|
|
24838
|
-
es5: {
|
|
24839
|
-
arrowFunctions: false,
|
|
24840
|
-
constBindings: false,
|
|
24841
|
-
objectShorthand: false,
|
|
24842
|
-
reservedNamesAsProps: true,
|
|
24843
|
-
symbols: false
|
|
24844
|
-
}
|
|
24845
|
-
};
|
|
24846
|
-
const objectifyOption = (value) => value && typeof value === 'object' ? value : {};
|
|
24847
|
-
const objectifyOptionWithPresets = (presets, optionName, urlSnippet, additionalValues) => (value) => {
|
|
24848
|
-
if (typeof value === 'string') {
|
|
24849
|
-
const preset = presets[value];
|
|
24850
|
-
if (preset) {
|
|
24851
|
-
return preset;
|
|
24852
|
-
}
|
|
24853
|
-
error(errorInvalidOption(optionName, urlSnippet, `valid values are ${additionalValues}${printQuotedStringList(Object.keys(presets))}. You can also supply an object for more fine-grained control`, value));
|
|
24854
|
-
}
|
|
24855
|
-
return objectifyOption(value);
|
|
24856
|
-
};
|
|
24857
|
-
const getOptionWithPreset = (value, presets, optionName, urlSnippet, additionalValues) => {
|
|
24858
|
-
const presetName = value?.preset;
|
|
24859
|
-
if (presetName) {
|
|
24860
|
-
const preset = presets[presetName];
|
|
24861
|
-
if (preset) {
|
|
24862
|
-
return { ...preset, ...value };
|
|
24863
|
-
}
|
|
24864
|
-
else {
|
|
24865
|
-
error(errorInvalidOption(`${optionName}.preset`, urlSnippet, `valid values are ${printQuotedStringList(Object.keys(presets))}`, presetName));
|
|
24866
|
-
}
|
|
24867
|
-
}
|
|
24868
|
-
return objectifyOptionWithPresets(presets, optionName, urlSnippet, additionalValues)(value);
|
|
24869
|
-
};
|
|
24870
|
-
const normalizePluginOption = async (plugins) => (await asyncFlatten([plugins])).filter(Boolean);
|
|
24871
|
-
|
|
24872
|
-
async function normalizeInputOptions(config) {
|
|
25063
|
+
async function normalizeInputOptions(config, watchMode) {
|
|
24873
25064
|
// These are options that may trigger special warnings or behaviour later
|
|
24874
25065
|
// if the user did not select an explicit value
|
|
24875
25066
|
const unsetOptions = new Set();
|
|
24876
25067
|
const context = config.context ?? 'undefined';
|
|
24877
|
-
const
|
|
25068
|
+
const plugins = await normalizePluginOption(config.plugins);
|
|
25069
|
+
const logLevel = config.logLevel || LOGLEVEL_INFO;
|
|
25070
|
+
const onLog = getLogger(plugins, getOnLog(config, logLevel), watchMode, logLevel);
|
|
24878
25071
|
const strictDeprecations = config.strictDeprecations || false;
|
|
24879
|
-
const maxParallelFileOps =
|
|
25072
|
+
const maxParallelFileOps = getMaxParallelFileOps(config, onLog, strictDeprecations);
|
|
24880
25073
|
const options = {
|
|
24881
25074
|
acorn: getAcorn(config),
|
|
24882
25075
|
acornInjectPlugins: getAcornInjectPlugins(config),
|
|
@@ -24885,43 +25078,28 @@ async function normalizeInputOptions(config) {
|
|
|
24885
25078
|
experimentalCacheExpiry: config.experimentalCacheExpiry ?? 10,
|
|
24886
25079
|
experimentalLogSideEffects: config.experimentalLogSideEffects || false,
|
|
24887
25080
|
external: getIdMatcher(config.external),
|
|
24888
|
-
inlineDynamicImports: getInlineDynamicImports$1(config,
|
|
25081
|
+
inlineDynamicImports: getInlineDynamicImports$1(config, onLog, strictDeprecations),
|
|
24889
25082
|
input: getInput(config),
|
|
25083
|
+
logLevel,
|
|
24890
25084
|
makeAbsoluteExternalsRelative: config.makeAbsoluteExternalsRelative ?? 'ifRelativeSource',
|
|
24891
|
-
manualChunks: getManualChunks$1(config,
|
|
25085
|
+
manualChunks: getManualChunks$1(config, onLog, strictDeprecations),
|
|
24892
25086
|
maxParallelFileOps,
|
|
24893
25087
|
maxParallelFileReads: maxParallelFileOps,
|
|
24894
25088
|
moduleContext: getModuleContext(config, context),
|
|
24895
|
-
|
|
25089
|
+
onLog,
|
|
25090
|
+
onwarn: warning => onLog(LOGLEVEL_WARN, warning),
|
|
24896
25091
|
perf: config.perf || false,
|
|
24897
|
-
plugins
|
|
25092
|
+
plugins,
|
|
24898
25093
|
preserveEntrySignatures: config.preserveEntrySignatures ?? 'exports-only',
|
|
24899
|
-
preserveModules: getPreserveModules$1(config,
|
|
25094
|
+
preserveModules: getPreserveModules$1(config, onLog, strictDeprecations),
|
|
24900
25095
|
preserveSymlinks: config.preserveSymlinks || false,
|
|
24901
25096
|
shimMissingExports: config.shimMissingExports || false,
|
|
24902
25097
|
strictDeprecations,
|
|
24903
25098
|
treeshake: getTreeshake(config)
|
|
24904
25099
|
};
|
|
24905
|
-
warnUnknownOptions(config, [...Object.keys(options), 'watch'], 'input options',
|
|
25100
|
+
warnUnknownOptions(config, [...Object.keys(options), 'watch'], 'input options', onLog, /^(output)$/);
|
|
24906
25101
|
return { options, unsetOptions };
|
|
24907
25102
|
}
|
|
24908
|
-
const getOnwarn = (config) => {
|
|
24909
|
-
const { onwarn } = config;
|
|
24910
|
-
return onwarn
|
|
24911
|
-
? warning => {
|
|
24912
|
-
warning.toString = () => {
|
|
24913
|
-
let warningString = '';
|
|
24914
|
-
if (warning.plugin)
|
|
24915
|
-
warningString += `(${warning.plugin} plugin) `;
|
|
24916
|
-
if (warning.loc)
|
|
24917
|
-
warningString += `${relativeId(warning.loc.file)} (${warning.loc.line}:${warning.loc.column}) `;
|
|
24918
|
-
warningString += warning.message;
|
|
24919
|
-
return warningString;
|
|
24920
|
-
};
|
|
24921
|
-
onwarn(warning, defaultOnWarn);
|
|
24922
|
-
}
|
|
24923
|
-
: defaultOnWarn;
|
|
24924
|
-
};
|
|
24925
25103
|
const getAcorn = (config) => ({
|
|
24926
25104
|
ecmaVersion: 'latest',
|
|
24927
25105
|
sourceType: 'module',
|
|
@@ -24956,10 +25134,10 @@ const getIdMatcher = (option) => {
|
|
|
24956
25134
|
}
|
|
24957
25135
|
return () => false;
|
|
24958
25136
|
};
|
|
24959
|
-
const getInlineDynamicImports$1 = (config,
|
|
25137
|
+
const getInlineDynamicImports$1 = (config, log, strictDeprecations) => {
|
|
24960
25138
|
const configInlineDynamicImports = config.inlineDynamicImports;
|
|
24961
25139
|
if (configInlineDynamicImports) {
|
|
24962
|
-
warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', URL_OUTPUT_INLINEDYNAMICIMPORTS, true,
|
|
25140
|
+
warnDeprecationWithOptions('The "inlineDynamicImports" option is deprecated. Use the "output.inlineDynamicImports" option instead.', URL_OUTPUT_INLINEDYNAMICIMPORTS, true, log, strictDeprecations);
|
|
24963
25141
|
}
|
|
24964
25142
|
return configInlineDynamicImports;
|
|
24965
25143
|
};
|
|
@@ -24967,17 +25145,17 @@ const getInput = (config) => {
|
|
|
24967
25145
|
const configInput = config.input;
|
|
24968
25146
|
return configInput == null ? [] : typeof configInput === 'string' ? [configInput] : configInput;
|
|
24969
25147
|
};
|
|
24970
|
-
const getManualChunks$1 = (config,
|
|
25148
|
+
const getManualChunks$1 = (config, log, strictDeprecations) => {
|
|
24971
25149
|
const configManualChunks = config.manualChunks;
|
|
24972
25150
|
if (configManualChunks) {
|
|
24973
|
-
warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', URL_OUTPUT_MANUALCHUNKS, true,
|
|
25151
|
+
warnDeprecationWithOptions('The "manualChunks" option is deprecated. Use the "output.manualChunks" option instead.', URL_OUTPUT_MANUALCHUNKS, true, log, strictDeprecations);
|
|
24974
25152
|
}
|
|
24975
25153
|
return configManualChunks;
|
|
24976
25154
|
};
|
|
24977
|
-
const
|
|
25155
|
+
const getMaxParallelFileOps = (config, log, strictDeprecations) => {
|
|
24978
25156
|
const maxParallelFileReads = config.maxParallelFileReads;
|
|
24979
25157
|
if (typeof maxParallelFileReads === 'number') {
|
|
24980
|
-
warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', URL_MAXPARALLELFILEOPS, true,
|
|
25158
|
+
warnDeprecationWithOptions('The "maxParallelFileReads" option is deprecated. Use the "maxParallelFileOps" option instead.', URL_MAXPARALLELFILEOPS, true, log, strictDeprecations);
|
|
24981
25159
|
}
|
|
24982
25160
|
const maxParallelFileOps = config.maxParallelFileOps ?? maxParallelFileReads;
|
|
24983
25161
|
if (typeof maxParallelFileOps === 'number') {
|
|
@@ -25001,10 +25179,10 @@ const getModuleContext = (config, context) => {
|
|
|
25001
25179
|
}
|
|
25002
25180
|
return () => context;
|
|
25003
25181
|
};
|
|
25004
|
-
const getPreserveModules$1 = (config,
|
|
25182
|
+
const getPreserveModules$1 = (config, log, strictDeprecations) => {
|
|
25005
25183
|
const configPreserveModules = config.preserveModules;
|
|
25006
25184
|
if (configPreserveModules) {
|
|
25007
|
-
warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', URL_OUTPUT_PRESERVEMODULES, true,
|
|
25185
|
+
warnDeprecationWithOptions('The "preserveModules" option is deprecated. Use the "output.preserveModules" option instead.', URL_OUTPUT_PRESERVEMODULES, true, log, strictDeprecations);
|
|
25008
25186
|
}
|
|
25009
25187
|
return configPreserveModules;
|
|
25010
25188
|
};
|
|
@@ -25041,7 +25219,7 @@ const getHasModuleSideEffects = (moduleSideEffectsOption) => {
|
|
|
25041
25219
|
return id => ids.has(id);
|
|
25042
25220
|
}
|
|
25043
25221
|
if (moduleSideEffectsOption) {
|
|
25044
|
-
error(
|
|
25222
|
+
error(logInvalidOption('treeshake.moduleSideEffects', URL_TREESHAKE_MODULESIDEEFFECTS, 'please use one of false, "no-external", a function or an array'));
|
|
25045
25223
|
}
|
|
25046
25224
|
return () => true;
|
|
25047
25225
|
};
|
|
@@ -25127,17 +25305,17 @@ async function normalizeOutputOptions(config, inputOptions, unsetInputOptions) {
|
|
|
25127
25305
|
systemNullSetters: config.systemNullSetters ?? true,
|
|
25128
25306
|
validate: config.validate || false
|
|
25129
25307
|
};
|
|
25130
|
-
warnUnknownOptions(config, Object.keys(outputOptions), 'output options', inputOptions.
|
|
25308
|
+
warnUnknownOptions(config, Object.keys(outputOptions), 'output options', inputOptions.onLog);
|
|
25131
25309
|
return { options: outputOptions, unsetOptions };
|
|
25132
25310
|
}
|
|
25133
25311
|
const getFile = (config, preserveModules, inputOptions) => {
|
|
25134
25312
|
const { file } = config;
|
|
25135
25313
|
if (typeof file === 'string') {
|
|
25136
25314
|
if (preserveModules) {
|
|
25137
|
-
return error(
|
|
25315
|
+
return error(logInvalidOption('output.file', URL_OUTPUT_DIR, 'you must set "output.dir" instead of "output.file" when using the "output.preserveModules" option'));
|
|
25138
25316
|
}
|
|
25139
25317
|
if (!Array.isArray(inputOptions.input))
|
|
25140
|
-
return error(
|
|
25318
|
+
return error(logInvalidOption('output.file', URL_OUTPUT_DIR, 'you must set "output.dir" instead of "output.file" when providing named inputs'));
|
|
25141
25319
|
}
|
|
25142
25320
|
return file;
|
|
25143
25321
|
};
|
|
@@ -25164,7 +25342,7 @@ const getFormat = (config) => {
|
|
|
25164
25342
|
return configFormat;
|
|
25165
25343
|
}
|
|
25166
25344
|
default: {
|
|
25167
|
-
return error(
|
|
25345
|
+
return error(logInvalidOption('output.format', URL_OUTPUT_FORMAT, `Valid values are "amd", "cjs", "system", "es", "iife" or "umd"`, configFormat));
|
|
25168
25346
|
}
|
|
25169
25347
|
}
|
|
25170
25348
|
};
|
|
@@ -25172,7 +25350,7 @@ const getInlineDynamicImports = (config, inputOptions) => {
|
|
|
25172
25350
|
const inlineDynamicImports = (config.inlineDynamicImports ?? inputOptions.inlineDynamicImports) || false;
|
|
25173
25351
|
const { input } = inputOptions;
|
|
25174
25352
|
if (inlineDynamicImports && (Array.isArray(input) ? input : Object.keys(input)).length > 1) {
|
|
25175
|
-
return error(
|
|
25353
|
+
return error(logInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, 'multiple inputs are not supported when "output.inlineDynamicImports" is true'));
|
|
25176
25354
|
}
|
|
25177
25355
|
return inlineDynamicImports;
|
|
25178
25356
|
};
|
|
@@ -25180,10 +25358,10 @@ const getPreserveModules = (config, inlineDynamicImports, inputOptions) => {
|
|
|
25180
25358
|
const preserveModules = (config.preserveModules ?? inputOptions.preserveModules) || false;
|
|
25181
25359
|
if (preserveModules) {
|
|
25182
25360
|
if (inlineDynamicImports) {
|
|
25183
|
-
return error(
|
|
25361
|
+
return error(logInvalidOption('output.inlineDynamicImports', URL_OUTPUT_INLINEDYNAMICIMPORTS, `this option is not supported for "output.preserveModules"`));
|
|
25184
25362
|
}
|
|
25185
25363
|
if (inputOptions.preserveEntrySignatures === false) {
|
|
25186
|
-
return error(
|
|
25364
|
+
return error(logInvalidOption('preserveEntrySignatures', URL_PRESERVEENTRYSIGNATURES, 'setting this option to false is not supported for "output.preserveModules"'));
|
|
25187
25365
|
}
|
|
25188
25366
|
}
|
|
25189
25367
|
return preserveModules;
|
|
@@ -25211,10 +25389,10 @@ const getAmd = (config) => {
|
|
|
25211
25389
|
...config.amd
|
|
25212
25390
|
};
|
|
25213
25391
|
if ((mergedOption.autoId || mergedOption.basePath) && mergedOption.id) {
|
|
25214
|
-
return error(
|
|
25392
|
+
return error(logInvalidOption('output.amd.id', URL_OUTPUT_AMD_ID, 'this option cannot be used together with "output.amd.autoId"/"output.amd.basePath"'));
|
|
25215
25393
|
}
|
|
25216
25394
|
if (mergedOption.basePath && !mergedOption.autoId) {
|
|
25217
|
-
return error(
|
|
25395
|
+
return error(logInvalidOption('output.amd.basePath', URL_OUTPUT_AMD_BASEPATH, 'this option only works with "output.amd.autoId"'));
|
|
25218
25396
|
}
|
|
25219
25397
|
return mergedOption.autoId
|
|
25220
25398
|
? {
|
|
@@ -25241,7 +25419,7 @@ const getAddon = (config, name) => {
|
|
|
25241
25419
|
const getDir = (config, file) => {
|
|
25242
25420
|
const { dir } = config;
|
|
25243
25421
|
if (typeof dir === 'string' && typeof file === 'string') {
|
|
25244
|
-
return error(
|
|
25422
|
+
return error(logInvalidOption('output.dir', URL_OUTPUT_DIR, 'you must set either "output.file" for a single-file build or "output.dir" when generating multiple chunks'));
|
|
25245
25423
|
}
|
|
25246
25424
|
return dir;
|
|
25247
25425
|
};
|
|
@@ -25250,7 +25428,7 @@ const getDynamicImportFunction = (config, inputOptions, format) => {
|
|
|
25250
25428
|
if (configDynamicImportFunction) {
|
|
25251
25429
|
warnDeprecation(`The "output.dynamicImportFunction" option is deprecated. Use the "renderDynamicImport" plugin hook instead.`, URL_RENDERDYNAMICIMPORT, true, inputOptions);
|
|
25252
25430
|
if (format !== 'es') {
|
|
25253
|
-
inputOptions.
|
|
25431
|
+
inputOptions.onLog(LOGLEVEL_WARN, logInvalidOption('output.dynamicImportFunction', URL_OUTPUT_DYNAMICIMPORTFUNCTION, 'this option is ignored for formats other than "es"'));
|
|
25254
25432
|
}
|
|
25255
25433
|
}
|
|
25256
25434
|
return configDynamicImportFunction;
|
|
@@ -25275,7 +25453,7 @@ function getExports(config, unsetOptions) {
|
|
|
25275
25453
|
unsetOptions.add('exports');
|
|
25276
25454
|
}
|
|
25277
25455
|
else if (!['default', 'named', 'none', 'auto'].includes(configExports)) {
|
|
25278
|
-
return error(
|
|
25456
|
+
return error(logInvalidExportOptionValue(configExports));
|
|
25279
25457
|
}
|
|
25280
25458
|
return configExports || 'auto';
|
|
25281
25459
|
}
|
|
@@ -25318,7 +25496,7 @@ const getInterop = (config) => {
|
|
|
25318
25496
|
};
|
|
25319
25497
|
const validateInterop = (interop) => {
|
|
25320
25498
|
if (!ALLOWED_INTEROP_TYPES.has(interop)) {
|
|
25321
|
-
return error(
|
|
25499
|
+
return error(logInvalidOption('output.interop', URL_OUTPUT_INTEROP,
|
|
25322
25500
|
// eslint-disable-next-line unicorn/prefer-spread
|
|
25323
25501
|
`use one of ${Array.from(ALLOWED_INTEROP_TYPES, value => JSON.stringify(value)).join(', ')}`, interop));
|
|
25324
25502
|
}
|
|
@@ -25328,10 +25506,10 @@ const getManualChunks = (config, inlineDynamicImports, preserveModules, inputOpt
|
|
|
25328
25506
|
const configManualChunks = config.manualChunks || inputOptions.manualChunks;
|
|
25329
25507
|
if (configManualChunks) {
|
|
25330
25508
|
if (inlineDynamicImports) {
|
|
25331
|
-
return error(
|
|
25509
|
+
return error(logInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.inlineDynamicImports"'));
|
|
25332
25510
|
}
|
|
25333
25511
|
if (preserveModules) {
|
|
25334
|
-
return error(
|
|
25512
|
+
return error(logInvalidOption('output.manualChunks', URL_OUTPUT_MANUALCHUNKS, 'this option is not supported for "output.preserveModules"'));
|
|
25335
25513
|
}
|
|
25336
25514
|
}
|
|
25337
25515
|
return configManualChunks || {};
|
|
@@ -25349,9 +25527,9 @@ const getSourcemapBaseUrl = (config) => {
|
|
|
25349
25527
|
const { sourcemapBaseUrl } = config;
|
|
25350
25528
|
if (sourcemapBaseUrl) {
|
|
25351
25529
|
if (isValidUrl(sourcemapBaseUrl)) {
|
|
25352
|
-
return sourcemapBaseUrl;
|
|
25530
|
+
return addTrailingSlashIfMissed(sourcemapBaseUrl);
|
|
25353
25531
|
}
|
|
25354
|
-
return error(
|
|
25532
|
+
return error(logInvalidOption('output.sourcemapBaseUrl', URL_OUTPUT_SOURCEMAPBASEURL, `must be a valid URL, received ${JSON.stringify(sourcemapBaseUrl)}`));
|
|
25355
25533
|
}
|
|
25356
25534
|
};
|
|
25357
25535
|
|
|
@@ -25399,13 +25577,13 @@ async function rollupInternal(rawInputOptions, watcher) {
|
|
|
25399
25577
|
closed: false,
|
|
25400
25578
|
async generate(rawOutputOptions) {
|
|
25401
25579
|
if (result.closed)
|
|
25402
|
-
return error(
|
|
25580
|
+
return error(logAlreadyClosed());
|
|
25403
25581
|
return handleGenerateWrite(false, inputOptions, unsetInputOptions, rawOutputOptions, graph);
|
|
25404
25582
|
},
|
|
25405
25583
|
watchFiles: Object.keys(graph.watchFiles),
|
|
25406
25584
|
async write(rawOutputOptions) {
|
|
25407
25585
|
if (result.closed)
|
|
25408
|
-
return error(
|
|
25586
|
+
return error(logAlreadyClosed());
|
|
25409
25587
|
return handleGenerateWrite(true, inputOptions, unsetInputOptions, rawOutputOptions, graph);
|
|
25410
25588
|
}
|
|
25411
25589
|
};
|
|
@@ -25413,21 +25591,34 @@ async function rollupInternal(rawInputOptions, watcher) {
|
|
|
25413
25591
|
result.getTimings = getTimings;
|
|
25414
25592
|
return result;
|
|
25415
25593
|
}
|
|
25416
|
-
async function getInputOptions(
|
|
25417
|
-
if (!
|
|
25594
|
+
async function getInputOptions(initialInputOptions, watchMode) {
|
|
25595
|
+
if (!initialInputOptions) {
|
|
25418
25596
|
throw new Error('You must supply an options object to rollup');
|
|
25419
25597
|
}
|
|
25420
|
-
const
|
|
25421
|
-
const { options, unsetOptions } = await normalizeInputOptions(
|
|
25598
|
+
const processedInputOptions = await getProcessedInputOptions(initialInputOptions, watchMode);
|
|
25599
|
+
const { options, unsetOptions } = await normalizeInputOptions(processedInputOptions, watchMode);
|
|
25422
25600
|
normalizePlugins(options.plugins, ANONYMOUS_PLUGIN_PREFIX);
|
|
25423
25601
|
return { options, unsetOptions };
|
|
25424
25602
|
}
|
|
25425
|
-
function
|
|
25426
|
-
|
|
25427
|
-
|
|
25428
|
-
|
|
25429
|
-
|
|
25430
|
-
|
|
25603
|
+
async function getProcessedInputOptions(inputOptions, watchMode) {
|
|
25604
|
+
const plugins = getSortedValidatedPlugins('options', await normalizePluginOption(inputOptions.plugins));
|
|
25605
|
+
const logLevel = inputOptions.logLevel || LOGLEVEL_INFO;
|
|
25606
|
+
const logger = getLogger(plugins, getOnLog(inputOptions, logLevel), watchMode, logLevel);
|
|
25607
|
+
for (const plugin of plugins) {
|
|
25608
|
+
const { name, options } = plugin;
|
|
25609
|
+
const handler = 'handler' in options ? options.handler : options;
|
|
25610
|
+
const processedOptions = await handler.call({
|
|
25611
|
+
debug: getLogHandler(LOGLEVEL_DEBUG, 'PLUGIN_LOG', logger, name, logLevel),
|
|
25612
|
+
error: (error_) => error(logPluginError(normalizeLog(error_), name, { hook: 'onLog' })),
|
|
25613
|
+
info: getLogHandler(LOGLEVEL_INFO, 'PLUGIN_LOG', logger, name, logLevel),
|
|
25614
|
+
meta: { rollupVersion: version$1, watchMode },
|
|
25615
|
+
warn: getLogHandler(LOGLEVEL_WARN, 'PLUGIN_WARNING', logger, name, logLevel)
|
|
25616
|
+
}, inputOptions);
|
|
25617
|
+
if (processedOptions) {
|
|
25618
|
+
inputOptions = processedOptions;
|
|
25619
|
+
}
|
|
25620
|
+
}
|
|
25621
|
+
return inputOptions;
|
|
25431
25622
|
}
|
|
25432
25623
|
function normalizePlugins(plugins, anonymousPrefix) {
|
|
25433
25624
|
for (const [index, plugin] of plugins.entries()) {
|
|
@@ -25444,7 +25635,7 @@ async function handleGenerateWrite(isWrite, inputOptions, unsetInputOptions, raw
|
|
|
25444
25635
|
if (isWrite) {
|
|
25445
25636
|
timeStart('WRITE', 1);
|
|
25446
25637
|
if (!outputOptions.dir && !outputOptions.file) {
|
|
25447
|
-
return error(
|
|
25638
|
+
return error(logMissingFileOrDirOption());
|
|
25448
25639
|
}
|
|
25449
25640
|
await Promise.all(Object.values(generated).map(chunk => graph.fileOperationQueue.run(() => writeOutputFile(chunk, outputOptions))));
|
|
25450
25641
|
await outputPluginDriver.hookParallel('writeBundle', [outputOptions, generated]);
|
|
@@ -25467,7 +25658,7 @@ async function getOutputOptionsAndPluginDriver(rawOutputOptions, inputPluginDriv
|
|
|
25467
25658
|
}
|
|
25468
25659
|
function getOutputOptions(inputOptions, unsetInputOptions, rawOutputOptions, outputPluginDriver) {
|
|
25469
25660
|
return normalizeOutputOptions(outputPluginDriver.hookReduceArg0Sync('outputOptions', [rawOutputOptions], (outputOptions, result) => result || outputOptions, pluginContext => {
|
|
25470
|
-
const emitError = () => pluginContext.error(
|
|
25661
|
+
const emitError = () => pluginContext.error(logCannotEmitFromOptionsHook());
|
|
25471
25662
|
return {
|
|
25472
25663
|
...pluginContext,
|
|
25473
25664
|
emitFile: emitError,
|