🔧 npm update
This commit is contained in:
63
node_modules/rollup/dist/shared/loadConfigFile.js
generated
vendored
63
node_modules/rollup/dist/shared/loadConfigFile.js
generated
vendored
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
@license
|
||||
Rollup.js v4.9.6
|
||||
Sun, 21 Jan 2024 05:51:51 GMT - commit ecb6b0a430098052781aa6ee04ec92ee70960321
|
||||
Rollup.js v4.40.0
|
||||
Sat, 12 Apr 2025 08:39:04 GMT - commit 1f2d579ccd4b39f223fed14ac7d031a6c848cd80
|
||||
|
||||
https://github.com/rollup/rollup
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
'use strict';
|
||||
|
||||
const promises = require('node:fs/promises');
|
||||
const node_path = require('node:path');
|
||||
const path = require('node:path');
|
||||
const process$1 = require('node:process');
|
||||
const node_url = require('node:url');
|
||||
const rollup = require('./rollup.js');
|
||||
@@ -63,14 +63,14 @@ function batchWarnings(command) {
|
||||
}
|
||||
case parseAst_js.LOGLEVEL_DEBUG: {
|
||||
if (!silent) {
|
||||
rollup.stderr(rollup.bold(rollup.blue(log.message)));
|
||||
rollup.stderr(rollup.bold(rollup.pc.blue(log.message)));
|
||||
defaultBody(log);
|
||||
}
|
||||
return;
|
||||
}
|
||||
default: {
|
||||
if (!silent) {
|
||||
rollup.stderr(rollup.bold(rollup.cyan(log.message)));
|
||||
rollup.stderr(rollup.bold(rollup.pc.cyan(log.message)));
|
||||
defaultBody(log);
|
||||
}
|
||||
}
|
||||
@@ -150,20 +150,16 @@ const deferredHandlers = {
|
||||
},
|
||||
PLUGIN_WARNING(warnings) {
|
||||
const nestedByPlugin = nest(warnings, 'plugin');
|
||||
for (const { key: plugin, items } of nestedByPlugin) {
|
||||
for (const { items } of nestedByPlugin) {
|
||||
const nestedByMessage = nest(items, 'message');
|
||||
let lastUrl = '';
|
||||
for (const { key: message, items } of nestedByMessage) {
|
||||
title(`Plugin ${plugin}: ${message}`);
|
||||
title(message);
|
||||
for (const warning of items) {
|
||||
if (warning.url && warning.url !== lastUrl)
|
||||
info((lastUrl = warning.url));
|
||||
const id = warning.id || warning.loc?.file;
|
||||
if (id) {
|
||||
let loc = parseAst_js.relativeId(id);
|
||||
if (warning.loc) {
|
||||
loc += `: (${warning.loc.line}:${warning.loc.column})`;
|
||||
}
|
||||
const loc = formatLocation(warning);
|
||||
if (loc) {
|
||||
rollup.stderr(rollup.bold(loc));
|
||||
}
|
||||
if (warning.frame)
|
||||
@@ -208,12 +204,11 @@ const deferredHandlers = {
|
||||
};
|
||||
function defaultBody(log) {
|
||||
if (log.url) {
|
||||
info(parseAst_js.getRollupUrl(log.url));
|
||||
info(log.url);
|
||||
}
|
||||
const id = log.loc?.file || log.id;
|
||||
if (id) {
|
||||
const loc = log.loc ? `${parseAst_js.relativeId(id)} (${log.loc.line}:${log.loc.column})` : parseAst_js.relativeId(id);
|
||||
rollup.stderr(rollup.bold(parseAst_js.relativeId(loc)));
|
||||
const loc = formatLocation(log);
|
||||
if (loc) {
|
||||
rollup.stderr(rollup.bold(loc));
|
||||
}
|
||||
if (log.frame)
|
||||
info(log.frame);
|
||||
@@ -261,6 +256,12 @@ function generateLogFilter(command) {
|
||||
}
|
||||
return getLogFilter_js.getLogFilter(filters);
|
||||
}
|
||||
function formatLocation(log) {
|
||||
const id = log.loc?.file || log.id;
|
||||
if (!id)
|
||||
return null;
|
||||
return log.loc ? `${id}:${log.loc.line}:${log.loc.column}` : id;
|
||||
}
|
||||
|
||||
const stdinName = '-';
|
||||
let stdinResult = null;
|
||||
@@ -383,11 +384,11 @@ async function loadAndRegisterPlugin(inputOptions, pluginText) {
|
||||
if (!plugin) {
|
||||
try {
|
||||
if (pluginText[0] == '.')
|
||||
pluginText = node_path.resolve(pluginText);
|
||||
pluginText = path.resolve(pluginText);
|
||||
// Windows absolute paths must be specified as file:// protocol URL
|
||||
// Note that we do not have coverage for Windows-only code paths
|
||||
else if (/^[A-Za-z]:\\/.test(pluginText)) {
|
||||
pluginText = node_url.pathToFileURL(node_path.resolve(pluginText)).href;
|
||||
pluginText = node_url.pathToFileURL(path.resolve(pluginText)).href;
|
||||
}
|
||||
plugin = await requireOrImport(pluginText);
|
||||
}
|
||||
@@ -417,7 +418,7 @@ function getCamelizedPluginBaseName(pluginText) {
|
||||
}
|
||||
async function requireOrImport(pluginPath) {
|
||||
try {
|
||||
// eslint-disable-next-line unicorn/prefer-module
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
return require(pluginPath);
|
||||
}
|
||||
catch {
|
||||
@@ -485,11 +486,16 @@ async function getConfigFileExport(fileName, commandOptions, watchMode) {
|
||||
function getDefaultFromCjs(namespace) {
|
||||
return namespace.default || namespace;
|
||||
}
|
||||
function getConfigImportAttributesKey(input) {
|
||||
if (input === 'assert' || input === 'with')
|
||||
return input;
|
||||
return;
|
||||
}
|
||||
async function loadTranspiledConfigFile(fileName, commandOptions) {
|
||||
const { bundleConfigAsCjs, configPlugin, silent } = commandOptions;
|
||||
const { bundleConfigAsCjs, configPlugin, configImportAttributesKey, silent } = commandOptions;
|
||||
const warnings = batchWarnings(commandOptions);
|
||||
const inputOptions = {
|
||||
external: (id) => (id[0] !== '.' && !node_path.isAbsolute(id)) || id.slice(-5, id.length) === '.json',
|
||||
external: (id) => (id[0] !== '.' && !path.isAbsolute(id)) || id.slice(-5) === '.json',
|
||||
input: fileName,
|
||||
onwarn: warnings.add,
|
||||
plugins: [],
|
||||
@@ -500,6 +506,7 @@ async function loadTranspiledConfigFile(fileName, commandOptions) {
|
||||
const { output: [{ code }] } = await bundle.generate({
|
||||
exports: 'named',
|
||||
format: bundleConfigAsCjs ? 'cjs' : 'es',
|
||||
importAttributesKey: getConfigImportAttributesKey(configImportAttributesKey),
|
||||
plugins: [
|
||||
{
|
||||
name: 'transpile-import-meta',
|
||||
@@ -507,8 +514,14 @@ async function loadTranspiledConfigFile(fileName, commandOptions) {
|
||||
if (property === 'url') {
|
||||
return `'${node_url.pathToFileURL(moduleId).href}'`;
|
||||
}
|
||||
if (property == 'filename') {
|
||||
return `'${moduleId}'`;
|
||||
}
|
||||
if (property == 'dirname') {
|
||||
return `'${path.dirname(moduleId)}'`;
|
||||
}
|
||||
if (property == null) {
|
||||
return `{url:'${node_url.pathToFileURL(moduleId).href}'}`;
|
||||
return `{url:'${node_url.pathToFileURL(moduleId).href}', filename: '${moduleId}', dirname: '${path.dirname(moduleId)}'}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,7 +531,7 @@ async function loadTranspiledConfigFile(fileName, commandOptions) {
|
||||
rollup.stderr(rollup.bold(`loaded ${parseAst_js.relativeId(fileName)} with warnings`));
|
||||
warnings.flush();
|
||||
}
|
||||
return loadConfigFromWrittenFile(node_path.join(node_path.dirname(fileName), `rollup.config-${Date.now()}.${bundleConfigAsCjs ? 'cjs' : 'mjs'}`), code);
|
||||
return loadConfigFromWrittenFile(path.join(path.dirname(fileName), `rollup.config-${Date.now()}.${bundleConfigAsCjs ? 'cjs' : 'mjs'}`), code);
|
||||
}
|
||||
async function loadConfigFromWrittenFile(bundledFileName, bundledCode) {
|
||||
await promises.writeFile(bundledFileName, bundledCode);
|
||||
|
||||
Reference in New Issue
Block a user