@qubit-ltd/rollup-builder 1.8.10 → 1.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rollup-builder.cjs.map +1 -1
- package/dist/rollup-builder.min.cjs.map +1 -1
- package/dist/rollup-builder.min.mjs.map +1 -1
- package/dist/rollup-builder.mjs.map +1 -1
- package/doc/api/global.html +1 -1
- package/doc/api/index.html +1 -1
- package/doc/rollup-builder.min.visualization.html +15 -15
- package/doc/rollup-builder.visualization.html +15 -15
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-builder.cjs","sources":["../src/get-rollup-external.mjs","../src/get-rollup-output.mjs","../src/plugins/config-alias-plugin.mjs","../src/plugins/config-node-resolve-plugin.mjs","../src/plugins/config-common-js-plugin.mjs","../src/plugins/config-babel-plugin.mjs","../src/plugins/config-terser-plugin.mjs","../src/plugins/config-analyzer-plugin.mjs","../src/plugins/config-visualizer-plugin.mjs","../src/get-rollup-plugins.mjs","../src/get-rollup-on-warn.mjs","../src/rollup-builder.mjs","../src/index.mjs"],"sourcesContent":["////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { createRequire } from 'node:module';\n\n/**\n * Gets Rollup `external` configuration.\n *\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {function}\n * The predicate used as the Rollup `external` configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupExternal(importMetaUrl, options) {\n if (!importMetaUrl) {\n throw new Error('importMetaUrl is required');\n }\n if (!options) {\n throw new Error('options is required');\n }\n // gets all peerDependencies packages from 'package.json' of the caller module\n const require = createRequire(importMetaUrl);\n const pkg = require('./package.json');\n const peers = [...Object.keys(pkg.peerDependencies || {})];\n if (!Array.isArray(peers)) {\n throw new Error('peerDependencies should be an array');\n }\n if (peers.length === 0) {\n return [];\n }\n const peerPattern = (peers ? new RegExp(`^(${peers.join('|')})($|/)`) : null);\n // gets the additional external packages from the user passed options\n const additions = options.externals ?? [];\n // save some configuration to the options object\n options.peers = peers;\n options.peerPattern = peerPattern;\n return (id) => {\n if (peerPattern && peerPattern.test(id)) {\n return true;\n }\n for (const pattern of additions) {\n if ((pattern instanceof RegExp) && pattern.test(id)) {\n return true;\n }\n if (((typeof pattern === 'string') || (pattern instanceof String)) && (pattern === id)) {\n return true;\n }\n }\n return false;\n };\n}\n\nexport default getRollupExternal;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Gets the Rollup `output` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} libraryName\n * The name of the library.\n * @param {object} options\n * The additional options for building the library.\n * @returns {object}\n * The Rollup output configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupOutput(format, libraryName, options) {\n let filenameExt = '';\n let footer = '';\n let exports = options.exports ?? 'auto';\n switch (format) {\n case 'cjs': // drop down\n case 'umd': // drop down\n filenameExt = (format === 'cjs' ? '.cjs' : `.${format}.js`);\n // The following workaround is to solve the following issue: If an ESM\n // module has both default export and named exports, the rollup cannot\n // handle it correctly. For example, the following is a source ESM module:\n // ```js\n // export { Foo, Bar };\n // export default Foo;\n // ```\n // The rollup will translate it into the following codes:\n // ```js\n // exports.Foo = Foo;\n // exports.Bar = Bar;\n // exports.default = Foo;\n // ```\n // However, a common-js consumer will use the module as follows:\n // ```js\n // const Foo = require('my-module');\n // ```\n // which will cause an error. The correct usage should be\n // ```js\n // const Foo = require('my-module').default\n // ```\n // But unfortunately, the rollup will translate the ESM default import as\n // follows:\n // ```js\n // import Foo from 'my-module';\n // ```\n // will be translated by rollup to\n // ```js\n // const Foo = require('my-module');\n // ```\n // Note that the above translation has no `.default` suffix, which will\n // cause an error.\n //\n // The workaround is copied from the source code of the official rollup\n // plugins:\n // https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n // It adds a simple footer statements to each `CJS` format bundle:\n // ```js\n // module.exports = Object.assign(exports.default, exports);\n // ```\n //\n // See:\n // [1] https://rollupjs.org/configuration-options/#output-exports\n // [2] https://github.com/rollup/rollup/issues/1961\n // [3] https://stackoverflow.com/questions/58246998/mixing-default-and-named-exports-with-rollup\n // [4] https://github.com/avisek/rollup-patch-seamless-default-export\n // [5] https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n if (exports === 'mixed') {\n exports = 'named';\n footer = 'module.exports = Object.assign(exports.default, exports);';\n }\n break;\n case 'amd': // drop down\n case 'iife':\n filenameExt = `.${format}.js`;\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n case 'es': // drop down\n case 'esm': // drop down\n case 'module':\n format = 'es';\n filenameExt = '.mjs';\n // fix the exports, because the ESM format does not support the 'mixed' exports mode\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n default:\n throw new Error(`Unsupported library format: ${format}`);\n }\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n const camelCaseToDashCase = (s) => s.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n const filenamePrefix = options.filenamePrefix ?? camelCaseToDashCase(libraryName);\n const filenameBase = `${filenamePrefix}${minify ? '.min' : ''}`;\n const filename = `${filenameBase}${filenameExt}`;\n const outputDir = options.outputDir ?? 'dist';\n const sourcemap = options.sourcemap ?? true;\n // save some configuration to the options object\n options.format = format;\n options.name = libraryName;\n options.minify = minify;\n options.filenamePrefix = filenamePrefix;\n options.filenameBase = filenameBase;\n options.filenameExt = filenameExt;\n options.filename = filename;\n options.exports = exports;\n options.sourcemap = sourcemap;\n options.outputDir = outputDir;\n return {\n name: libraryName,\n file: `${outputDir}/${filename}`,\n format,\n exports,\n footer,\n sourcemap,\n compact: minify,\n };\n}\n\nexport default getRollupOutput;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { fileURLToPath } from 'node:url';\nimport alias from '@rollup/plugin-alias';\n\n/**\n * Configures the `@rollup/plugin-alias` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-alias\n */\nfunction configAliasPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAliasPlugin ?? true) {\n // The @rollup/plugin-alias enables us to use absolute import paths for\n // \"src\" (or any other path you want to configure).\n const pluginOptions = options.aliasPluginOptions ?? {\n entries: {\n 'src': fileURLToPath(new URL('src', importMetaUrl)),\n },\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-alias plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(alias(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAliasPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport nodeResolve from '@rollup/plugin-node-resolve';\n\n/**\n * Configures the `@rollup/plugin-node-resolve` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-node-resolve\n */\nfunction configNodeResolvePlugin(format, importMetaUrl, options, plugins) {\n if (options.useNodeResolvePlugin ?? true) {\n // The @rollup/plugin-node-resolve allows Rollup to resolve external\n // modules from node_modules:\n const pluginOptions = options.nodeResolvePluginOptions ?? {};\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-node-resolve plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(nodeResolve(pluginOptions));\n }\n return plugins;\n}\n\nexport default configNodeResolvePlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport commonjs from '@rollup/plugin-commonjs';\n\n/**\n * Configures the `@rollup/plugin-commonjs` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-commonjs\n */\nfunction configCommonJsPlugin(format, importMetaUrl, options, plugins) {\n if (options.useCommonjsPlugin ?? true) {\n // The @rollup/plugin-commonjs plugin converts 3rd-party CommonJS modules\n // into ES6 code, so that they can be included in our Rollup bundle.\n // When using @rollup/plugin-babel with @rollup/plugin-commonjs in the\n // same Rollup configuration, it's important to note that\n // @rollup/plugin-commonjs must be placed before this plugin in the\n // plugins array for the two to work together properly.\n const pluginOptions = options.commonjsPluginOptions ?? {\n include: ['node_modules/**'],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-commonjs plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(commonjs(pluginOptions));\n }\n return plugins;\n}\n\nexport default configCommonJsPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport babel from '@rollup/plugin-babel';\n\n/**\n * Configures the `@rollup/plugin-babel` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-babel\n */\nfunction configBabelPlugin(format, importMetaUrl, options, plugins) {\n if (options.useBabelPlugin ?? true) {\n const pluginOptions = options.babelPluginOptions ?? {\n babelHelpers: 'runtime',\n exclude: ['node_modules/**'],\n presets: [\n // The @babel/preset-env preset enables Babel to transpile ES6+ code\n // and the rollup requires that Babel keeps ES6 module syntax intact.\n ['@babel/preset-env', { modules: false }],\n ],\n plugins: [\n '@babel/plugin-transform-runtime',\n ],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-babel plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(babel(pluginOptions));\n }\n return plugins;\n}\n\nexport default configBabelPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport terser from '@rollup/plugin-terser';\n\n/**\n * Configures the `@rollup/plugin-terser` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-terser\n */\nfunction configTerserPlugin(format, importMetaUrl, options, plugins) {\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n if (minify) {\n // The @rollup/plugin-terser uses terser under the hood to minify the code.\n const pluginOptions = options.terserPluginOptions ?? {\n output: {\n comments: false, // default to remove all comments\n },\n keep_classnames: true, // keep the class names\n keep_fnames: true, // keep the function names\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-terser plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(terser(pluginOptions));\n }\n return plugins;\n}\n\nexport default configTerserPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport analyzer from 'rollup-plugin-analyzer';\n\n/**\n * Configures the `rollup-plugin-analyzer` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-analyzer\n */\nfunction configAnalyzerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAnalyzerPlugin ?? true) {\n // The rollup-plugin-analyzer will print out some useful info about our\n // generated bundle upon successful builds.\n const pluginOptions = options.analyzerPluginOptions ?? {\n hideDeps: true,\n limit: 0,\n summaryOnly: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-analyzer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(analyzer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAnalyzerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { visualizer } from 'rollup-plugin-visualizer';\n\n/**\n * Configures the `rollup-plugin-visualizer` plugin.\n *\n * The `rollup-plugin-visualizer` will visualize and analyze your Rollup\n * bundle to see which modules are taking up space.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-visualizer\n */\nfunction configVisualizerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useVisualizerPlugin ?? true) {\n // The rollup-plugin-visualizer will visualize and analyze your Rollup\n // bundle to see which modules are taking up space.\n const pluginOptions = options.visualizerPluginOptions ?? {\n filename: `./doc/${options.filenameBase}.visualization.html`,\n gzipSize: true,\n brotliSize: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-visualizer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(visualizer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configVisualizerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport json from '@rollup/plugin-json';\nimport configAliasPlugin from './plugins/config-alias-plugin.mjs';\nimport configNodeResolvePlugin from './plugins/config-node-resolve-plugin.mjs';\nimport configCommonJsPlugin from './plugins/config-common-js-plugin.mjs';\nimport configBabelPlugin from './plugins/config-babel-plugin.mjs';\nimport configTerserPlugin from './plugins/config-terser-plugin.mjs';\nimport configAnalyzerPlugin from './plugins/config-analyzer-plugin.mjs';\nimport configVisualizerPlugin from './plugins/config-visualizer-plugin.mjs';\n\n/**\n * Gets Rollup `plugins` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {Array<Object>}\n * The Rollup plugins array.\n * @author Haixing Hu\n */\nfunction getRollupPlugins(format, importMetaUrl, options) {\n const plugins = [];\n plugins.push(json());\n configAliasPlugin(format, importMetaUrl, options, plugins);\n configNodeResolvePlugin(format, importMetaUrl, options, plugins);\n configCommonJsPlugin(format, importMetaUrl, options, plugins);\n configBabelPlugin(format, importMetaUrl, options, plugins);\n configTerserPlugin(format, importMetaUrl, options, plugins);\n configAnalyzerPlugin(format, importMetaUrl, options, plugins);\n configVisualizerPlugin(format, importMetaUrl, options, plugins);\n // The user can specify additional plugins.\n if (options.plugins) {\n plugins.push(...options.plugins);\n }\n return plugins;\n}\n\nexport default getRollupPlugins;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2024.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\nfunction getRollupOnWarn() {\n return function onWarn(warning, warn) {\n // skip certain warnings\n if (warning.code === 'INVALID_ANNOTATION'\n && warning.message.includes('#__PURE__')\n && warning.message.includes('terser')) {\n return;\n }\n if (warning.code === 'CIRCULAR_DEPENDENCY'\n && warning.message.includes('node_modules')) {\n return;\n }\n // Use default for everything else\n warn(warning);\n };\n}\n\nexport default getRollupOnWarn;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport getRollupExternal from './get-rollup-external.mjs';\nimport getRollupOutput from './get-rollup-output.mjs';\nimport getRollupPlugins from './get-rollup-plugins.mjs';\nimport getRollupOnWarn from './get-rollup-on-warn.mjs';\n\n/**\n * Builds the Rollup configuration for a library.\n *\n * The function could be provided with an additional options for building the\n * library. It can have the following fields:\n *\n * - `debug: boolean`: whether to print the debug information. If this field is\n * not specified, the default value is `false`.\n * - `formats: [string]`: the array of formats of the library. It can be an\n * array of the following values:\n * - `'cjs'`: the CommonJS format.\n * - `'umd'`: the UMD format.\n * - `'esm'`: the ES module format.\n *\n * If this field is not specified, the default value is `['cjs', 'esm']`.\n * - `exports: string`: the export mode to use. It can be one of the following\n * values:\n * - `'auto'`: automatically guesses your intentions based on what the input\n * module exports.\n * - `'default'`: if you are only exporting one thing using `export default ...`;\n * note that this can cause issues when generating CommonJS output that is\n * meant to be interchangeable with ESM output.\n * - `'named'`: if you are using named exports.\n * - `'none'`: if you are not exporting anything (e.g. you are building an\n * app, not a library)\n * - `'mixed'`: if you are using named exports mixed with a default export.\n * Note that this is not a standard exports mode officially supported by\n * the `rollup`, instead, it is an additional mode add by this library.\n *\n * See [output.exports](https://rollupjs.org/configuration-options/#output-exports)\n * for more details. If this field is not specified, the default value is\n * `'auto'`.\n * - `nodeEnv: string`: the value of the `NODE_ENV` environment variable. If\n * this field is not specified, the default value is `process.env.NODE_ENV`.\n * - `minify: boolean`: whether to minify the code. If this field is not\n * specified, and the `nodeEnv` is `production`, the default value is `true`;\n * otherwise the default value is `false`.\n * - `sourcemap: boolean`: whether to generate the source map. If this field is\n * not specified, the default value is `true`.\n * - `input: string`: the input file of the library. If this field is not\n * specified, the default value is `src/index.js`.\n * - `outputDir: string`: the output directory of the library. If this field is\n * not specified, the default value is `dist`.\n * - `filenamePrefix: string`: the prefix of the output filename. If this field\n * is not specified, the default value is the dash case of the library name.\n * For example, if the library name is `MyLibrary`, the default value of this\n * field is `my-library`.\n * - `externals: [string]`: the array of additional external packages, each can\n * be specified with either a string or a regular expression. If this field is\n * not specified, the default value is an empty array.\n * - `useAliasPlugin: boolean`: whether to use the `@rollup/plugin-alias` plugin.\n * If this field is not specified, the default value is `true`.\n * - `aliasPluginOptions: object`: the options for the `@rollup/plugin-alias`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * entries: {\n * 'src': fileURLToPath(new URL('src', importMetaUrl)),\n * },\n * }\n * ```\n * - `useNodeResolvePlugin: boolean`: whether to use the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is `true`.\n * - `nodeResolvePluginOptions: object`: the options for the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is: `{}`.\n * - `useCommonjsPlugin: boolean`: whether to use the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is `true`.\n * - `commonjsPluginOptions: object`: the options for the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * include: ['node_modules/**'],\n * }\n * ```\n * - `useBabelPlugin: boolean`: whether to use the `@rollup/plugin-babel` plugin.\n * If this field is not specified, the default value is `true`.\n * - `babelPluginOptions: object`: the options for the `@rollup/plugin-babel`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * babelHelpers: 'runtime',\n * exclude: ['node_modules/**'],\n * presets: [\n * '@babel/preset-env',\n * ],\n * plugins: [\n * '@babel/plugin-transform-runtime',\n * ],\n * }\n * ```\n * Note that when using the `@rollup/plugin-babel` plugin, you can also specify\n * the configuration of Babel in the standard Babel configuration files,\n * such as `babel.config.js`, `.babelrc`, etc.\n * - `terserOptions: object`: the options for the `@rollup/plugin-terser` plugin.\n * If this field is not specified, the default value is: `{}`. Whether to use\n * the `@rollup/plugin-terser` plugin depends on the `minify` field of the\n * options or the `NODE_ENV` environment variable.\n * - `useAnalyzerPlugin: boolean`: whether to use the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is `true`.\n * - `analyzerOptions: object`: the options for the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * hideDeps: true,\n * limit: 0,\n * summaryOnly: true,\n * }\n * ```\n * - `plugins: [object]`: the array of configuration of additional Rollup\n * plugins. If this field is not specified, the default value is an empty\n * array.\n *\n * @param {string} libraryName\n * The name of the library, which will be used as the name of the global\n * variable in the UMD format. It should in the camel case.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module. It **MUST** be passed\n * with the `import.meta.url` of the caller module.\n * @param {object} options\n * The additional options for building the library, as described above.\n * @returns {Array<object>}\n * the array of Rollup configurations for the library.\n */\nfunction rollupBuilder(libraryName, importMetaUrl, options = {}) {\n const formats = options.formats ?? ['cjs', 'esm'];\n const result = [];\n const input = options.input ?? 'src/index.js';\n for (const format of formats) {\n const clonedOptions = { ...options };\n const output = getRollupOutput(format, libraryName, clonedOptions);\n const external = getRollupExternal(importMetaUrl, clonedOptions);\n const plugins = getRollupPlugins(format, importMetaUrl, clonedOptions);\n const onwarn = getRollupOnWarn();\n const config = { input, output, external, plugins, onwarn };\n result.push(config);\n if (options.debug === true) {\n console.debug(`[DEBUG] The options for the format ${format} is:`);\n console.dir(clonedOptions, { depth: null });\n }\n }\n if (options.debug === true) {\n console.debug('[DEBUG] The generated rollup configurations are:');\n console.dir(result, { depth: null });\n }\n return result;\n}\n\nexport default rollupBuilder;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport rollupBuilder from './rollup-builder.mjs';\n\nexport default rollupBuilder;\n"],"names":["getRollupExternal","importMetaUrl","options","_options$externals","Error","require","createRequire","pkg","peers","_toConsumableArray","Object","keys","peerDependencies","Array","isArray","length","peerPattern","RegExp","concat","join","additions","externals","id","test","_iterator","_createForOfIteratorHelper","_step","s","n","done","pattern","value","String","err","e","f","getRollupOutput","format","libraryName","_options$exports","_options$nodeEnv","_options$minify","_options$filenamePref","_options$outputDir","_options$sourcemap","filenameExt","footer","exports","nodeEnv","process","env","NODE_ENV","minify","camelCaseToDashCase","replace","toLowerCase","filenamePrefix","filenameBase","filename","outputDir","sourcemap","name","file","compact","configAliasPlugin","plugins","_options$useAliasPlug","useAliasPlugin","_options$aliasPluginO","pluginOptions","aliasPluginOptions","entries","fileURLToPath","URL","debug","console","dir","depth","push","alias","configNodeResolvePlugin","_options$useNodeResol","useNodeResolvePlugin","_options$nodeResolveP","nodeResolvePluginOptions","nodeResolve","configCommonJsPlugin","_options$useCommonjsP","useCommonjsPlugin","_options$commonjsPlug","commonjsPluginOptions","include","commonjs","configBabelPlugin","_options$useBabelPlug","useBabelPlugin","_options$babelPluginO","babelPluginOptions","babelHelpers","exclude","presets","modules","babel","configTerserPlugin","_options$terserPlugin","terserPluginOptions","output","comments","keep_classnames","keep_fnames","terser","configAnalyzerPlugin","_options$useAnalyzerP","useAnalyzerPlugin","_options$analyzerPlug","analyzerPluginOptions","hideDeps","limit","summaryOnly","analyzer","configVisualizerPlugin","_options$useVisualize","useVisualizerPlugin","_options$visualizerPl","visualizerPluginOptions","gzipSize","brotliSize","visualizer","getRollupPlugins","json","apply","getRollupOnWarn","onWarn","warning","warn","code","message","includes","rollupBuilder","_options$formats","_options$input","arguments","undefined","formats","result","input","clonedOptions","_objectSpread","external","onwarn","config"],"mappings":";;;;;;;;;;;;;;;;;;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiBA,CAACC,aAAa,EAAEC,OAAO,EAAE;AAAA,EAAA,IAAAC,kBAAA;EACjD,IAAI,CAACF,aAAa,EAAE;AAClB,IAAA,MAAM,IAAIG,KAAK,CAAC,2BAA2B,CAAC;AAC9C;EACA,IAAI,CAACF,OAAO,EAAE;AACZ,IAAA,MAAM,IAAIE,KAAK,CAAC,qBAAqB,CAAC;AACxC;AACA;AACA,EAAA,IAAMC,OAAO,GAAGC,yBAAa,CAACL,aAAa,CAAC;AAC5C,EAAA,IAAMM,GAAG,GAAGF,OAAO,CAAC,gBAAgB,CAAC;AACrC,EAAA,IAAMG,KAAK,GAAAC,kBAAA,CAAOC,MAAM,CAACC,IAAI,CAACJ,GAAG,CAACK,gBAAgB,IAAI,EAAE,CAAC,CAAC;AAC1D,EAAA,IAAI,CAACC,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;AACzB,IAAA,MAAM,IAAIJ,KAAK,CAAC,qCAAqC,CAAC;AACxD;AACA,EAAA,IAAII,KAAK,CAACO,MAAM,KAAK,CAAC,EAAE;AACtB,IA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AAC;EAC3D8C,oBAAoB,CAAC1E,MAAM,EAAEpC,aAAa,EAAEC,OAAO,EAAE+D,OAAO,CAAC;EAC7DuD,sBAAsB,CAACnF,MAAM,EAAEpC,aAAa,EAAEC,OAAO,EAAE+D,OAAO,CAAC;AAC/D;EACA,IAAI/D,OAAO,CAAC+D,OAAO,EAAE;AACnBA,IAAAA,OAAO,CAACa,IAAI,CAAAoD,KAAA,CAAZjE,OAAO,EAAAxD,kBAAA,CAASP,OAAO,CAAC+D,OAAO,CAAC,CAAA;AAClC;AACA,EAAA,OAAOA,OAAO;AAChB;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASkE,eAAeA,GAAG;AACzB,EAAA,OAAO,SAASC,MAAMA,CAACC,OAAO,EAAEC,IAAI,EAAE;AACpC;IACA,IAAID,OAAO,CAACE,IAAI,KAAK,oBAAoB,IAClCF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,WAAW,CAAC,IACrCJ,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;AACzC,MAAA;AACF;AACA,IAAA,IAAIJ,OAAO,CAACE,IAAI,KAAK,qBAAqB,IACnCF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,cAAc,CAAC,EAAE;AAC/C,MAAA;AACF;AACA;IACAH,IAAI,CAACD,OAAO,CAAC;GACd;AACH;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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ollup-output.mjs","../src/plugins/config-alias-plugin.mjs","../src/plugins/config-node-resolve-plugin.mjs","../src/plugins/config-common-js-plugin.mjs","../src/plugins/config-babel-plugin.mjs","../src/plugins/config-terser-plugin.mjs","../src/plugins/config-analyzer-plugin.mjs","../src/plugins/config-visualizer-plugin.mjs","../src/get-rollup-plugins.mjs","../src/get-rollup-on-warn.mjs","../src/rollup-builder.mjs","../src/index.mjs"],"sourcesContent":["////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { createRequire } from 'node:module';\n\n/**\n * Gets Rollup `external` configuration.\n *\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {function}\n * The predicate used as the Rollup `external` configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupExternal(importMetaUrl, options) {\n if (!importMetaUrl) {\n throw new Error('importMetaUrl is required');\n }\n if (!options) {\n throw new Error('options is required');\n }\n // gets all peerDependencies packages from 'package.json' of the caller module\n const require = createRequire(importMetaUrl);\n const pkg = require('./package.json');\n const peers = [...Object.keys(pkg.peerDependencies || {})];\n if (!Array.isArray(peers)) {\n throw new Error('peerDependencies should be an array');\n }\n if (peers.length === 0) {\n return [];\n }\n const peerPattern = (peers ? new RegExp(`^(${peers.join('|')})($|/)`) : null);\n // gets the additional external packages from the user passed options\n const additions = options.externals ?? [];\n // save some configuration to the options object\n options.peers = peers;\n options.peerPattern = peerPattern;\n return (id) => {\n if (peerPattern && peerPattern.test(id)) {\n return true;\n }\n for (const pattern of additions) {\n if ((pattern instanceof RegExp) && pattern.test(id)) {\n return true;\n }\n if (((typeof pattern === 'string') || (pattern instanceof String)) && (pattern === id)) {\n return true;\n }\n }\n return false;\n };\n}\n\nexport default getRollupExternal;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Gets the Rollup `output` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} libraryName\n * The name of the library.\n * @param {object} options\n * The additional options for building the library.\n * @returns {object}\n * The Rollup output configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupOutput(format, libraryName, options) {\n let filenameExt = '';\n let footer = '';\n let exports = options.exports ?? 'auto';\n switch (format) {\n case 'cjs': // drop down\n case 'umd': // drop down\n filenameExt = (format === 'cjs' ? '.cjs' : `.${format}.js`);\n // The following workaround is to solve the following issue: If an ESM\n // module has both default export and named exports, the rollup cannot\n // handle it correctly. For example, the following is a source ESM module:\n // ```js\n // export { Foo, Bar };\n // export default Foo;\n // ```\n // The rollup will translate it into the following codes:\n // ```js\n // exports.Foo = Foo;\n // exports.Bar = Bar;\n // exports.default = Foo;\n // ```\n // However, a common-js consumer will use the module as follows:\n // ```js\n // const Foo = require('my-module');\n // ```\n // which will cause an error. The correct usage should be\n // ```js\n // const Foo = require('my-module').default\n // ```\n // But unfortunately, the rollup will translate the ESM default import as\n // follows:\n // ```js\n // import Foo from 'my-module';\n // ```\n // will be translated by rollup to\n // ```js\n // const Foo = require('my-module');\n // ```\n // Note that the above translation has no `.default` suffix, which will\n // cause an error.\n //\n // The workaround is copied from the source code of the official rollup\n // plugins:\n // https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n // It adds a simple footer statements to each `CJS` format bundle:\n // ```js\n // module.exports = Object.assign(exports.default, exports);\n // ```\n //\n // See:\n // [1] https://rollupjs.org/configuration-options/#output-exports\n // [2] https://github.com/rollup/rollup/issues/1961\n // [3] https://stackoverflow.com/questions/58246998/mixing-default-and-named-exports-with-rollup\n // [4] https://github.com/avisek/rollup-patch-seamless-default-export\n // [5] https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n if (exports === 'mixed') {\n exports = 'named';\n footer = 'module.exports = Object.assign(exports.default, exports);';\n }\n break;\n case 'amd': // drop down\n case 'iife':\n filenameExt = `.${format}.js`;\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n case 'es': // drop down\n case 'esm': // drop down\n case 'module':\n format = 'es';\n filenameExt = '.mjs';\n // fix the exports, because the ESM format does not support the 'mixed' exports mode\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n default:\n throw new Error(`Unsupported library format: ${format}`);\n }\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n const camelCaseToDashCase = (s) => s.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n const filenamePrefix = options.filenamePrefix ?? camelCaseToDashCase(libraryName);\n const filenameBase = `${filenamePrefix}${minify ? '.min' : ''}`;\n const filename = `${filenameBase}${filenameExt}`;\n const outputDir = options.outputDir ?? 'dist';\n const sourcemap = options.sourcemap ?? true;\n // save some configuration to the options object\n options.format = format;\n options.name = libraryName;\n options.minify = minify;\n options.filenamePrefix = filenamePrefix;\n options.filenameBase = filenameBase;\n options.filenameExt = filenameExt;\n options.filename = filename;\n options.exports = exports;\n options.sourcemap = sourcemap;\n options.outputDir = outputDir;\n return {\n name: libraryName,\n file: `${outputDir}/${filename}`,\n format,\n exports,\n footer,\n sourcemap,\n compact: minify,\n };\n}\n\nexport default getRollupOutput;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { fileURLToPath } from 'node:url';\nimport alias from '@rollup/plugin-alias';\n\n/**\n * Configures the `@rollup/plugin-alias` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-alias\n */\nfunction configAliasPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAliasPlugin ?? true) {\n // The @rollup/plugin-alias enables us to use absolute import paths for\n // \"src\" (or any other path you want to configure).\n const pluginOptions = options.aliasPluginOptions ?? {\n entries: {\n 'src': fileURLToPath(new URL('src', importMetaUrl)),\n },\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-alias plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(alias(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAliasPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport nodeResolve from '@rollup/plugin-node-resolve';\n\n/**\n * Configures the `@rollup/plugin-node-resolve` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-node-resolve\n */\nfunction configNodeResolvePlugin(format, importMetaUrl, options, plugins) {\n if (options.useNodeResolvePlugin ?? true) {\n // The @rollup/plugin-node-resolve allows Rollup to resolve external\n // modules from node_modules:\n const pluginOptions = options.nodeResolvePluginOptions ?? {};\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-node-resolve plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(nodeResolve(pluginOptions));\n }\n return plugins;\n}\n\nexport default configNodeResolvePlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport commonjs from '@rollup/plugin-commonjs';\n\n/**\n * Configures the `@rollup/plugin-commonjs` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-commonjs\n */\nfunction configCommonJsPlugin(format, importMetaUrl, options, plugins) {\n if (options.useCommonjsPlugin ?? true) {\n // The @rollup/plugin-commonjs plugin converts 3rd-party CommonJS modules\n // into ES6 code, so that they can be included in our Rollup bundle.\n // When using @rollup/plugin-babel with @rollup/plugin-commonjs in the\n // same Rollup configuration, it's important to note that\n // @rollup/plugin-commonjs must be placed before this plugin in the\n // plugins array for the two to work together properly.\n const pluginOptions = options.commonjsPluginOptions ?? {\n include: ['node_modules/**'],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-commonjs plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(commonjs(pluginOptions));\n }\n return plugins;\n}\n\nexport default configCommonJsPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport babel from '@rollup/plugin-babel';\n\n/**\n * Configures the `@rollup/plugin-babel` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-babel\n */\nfunction configBabelPlugin(format, importMetaUrl, options, plugins) {\n if (options.useBabelPlugin ?? true) {\n const pluginOptions = options.babelPluginOptions ?? {\n babelHelpers: 'runtime',\n exclude: ['node_modules/**'],\n presets: [\n // The @babel/preset-env preset enables Babel to transpile ES6+ code\n // and the rollup requires that Babel keeps ES6 module syntax intact.\n ['@babel/preset-env', { modules: false }],\n ],\n plugins: [\n '@babel/plugin-transform-runtime',\n ],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-babel plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(babel(pluginOptions));\n }\n return plugins;\n}\n\nexport default configBabelPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport terser from '@rollup/plugin-terser';\n\n/**\n * Configures the `@rollup/plugin-terser` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-terser\n */\nfunction configTerserPlugin(format, importMetaUrl, options, plugins) {\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n if (minify) {\n // The @rollup/plugin-terser uses terser under the hood to minify the code.\n const pluginOptions = options.terserPluginOptions ?? {\n output: {\n comments: false, // default to remove all comments\n },\n keep_classnames: true, // keep the class names\n keep_fnames: true, // keep the function names\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-terser plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(terser(pluginOptions));\n }\n return plugins;\n}\n\nexport default configTerserPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport analyzer from 'rollup-plugin-analyzer';\n\n/**\n * Configures the `rollup-plugin-analyzer` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-analyzer\n */\nfunction configAnalyzerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAnalyzerPlugin ?? true) {\n // The rollup-plugin-analyzer will print out some useful info about our\n // generated bundle upon successful builds.\n const pluginOptions = options.analyzerPluginOptions ?? {\n hideDeps: true,\n limit: 0,\n summaryOnly: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-analyzer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(analyzer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAnalyzerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { visualizer } from 'rollup-plugin-visualizer';\n\n/**\n * Configures the `rollup-plugin-visualizer` plugin.\n *\n * The `rollup-plugin-visualizer` will visualize and analyze your Rollup\n * bundle to see which modules are taking up space.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-visualizer\n */\nfunction configVisualizerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useVisualizerPlugin ?? true) {\n // The rollup-plugin-visualizer will visualize and analyze your Rollup\n // bundle to see which modules are taking up space.\n const pluginOptions = options.visualizerPluginOptions ?? {\n filename: `./doc/${options.filenameBase}.visualization.html`,\n gzipSize: true,\n brotliSize: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-visualizer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(visualizer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configVisualizerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport json from '@rollup/plugin-json';\nimport configAliasPlugin from './plugins/config-alias-plugin.mjs';\nimport configNodeResolvePlugin from './plugins/config-node-resolve-plugin.mjs';\nimport configCommonJsPlugin from './plugins/config-common-js-plugin.mjs';\nimport configBabelPlugin from './plugins/config-babel-plugin.mjs';\nimport configTerserPlugin from './plugins/config-terser-plugin.mjs';\nimport configAnalyzerPlugin from './plugins/config-analyzer-plugin.mjs';\nimport configVisualizerPlugin from './plugins/config-visualizer-plugin.mjs';\n\n/**\n * Gets Rollup `plugins` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {Array<Object>}\n * The Rollup plugins array.\n * @author Haixing Hu\n */\nfunction getRollupPlugins(format, importMetaUrl, options) {\n const plugins = [];\n plugins.push(json());\n configAliasPlugin(format, importMetaUrl, options, plugins);\n configNodeResolvePlugin(format, importMetaUrl, options, plugins);\n configCommonJsPlugin(format, importMetaUrl, options, plugins);\n configBabelPlugin(format, importMetaUrl, options, plugins);\n configTerserPlugin(format, importMetaUrl, options, plugins);\n configAnalyzerPlugin(format, importMetaUrl, options, plugins);\n configVisualizerPlugin(format, importMetaUrl, options, plugins);\n // The user can specify additional plugins.\n if (options.plugins) {\n plugins.push(...options.plugins);\n }\n return plugins;\n}\n\nexport default getRollupPlugins;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2024.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\nfunction getRollupOnWarn() {\n return function onWarn(warning, warn) {\n // skip certain warnings\n if (warning.code === 'INVALID_ANNOTATION'\n && warning.message.includes('#__PURE__')\n && warning.message.includes('terser')) {\n return;\n }\n if (warning.code === 'CIRCULAR_DEPENDENCY'\n && warning.message.includes('node_modules')) {\n return;\n }\n // Use default for everything else\n warn(warning);\n };\n}\n\nexport default getRollupOnWarn;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport getRollupExternal from './get-rollup-external.mjs';\nimport getRollupOutput from './get-rollup-output.mjs';\nimport getRollupPlugins from './get-rollup-plugins.mjs';\nimport getRollupOnWarn from './get-rollup-on-warn.mjs';\n\n/**\n * Builds the Rollup configuration for a library.\n *\n * The function could be provided with an additional options for building the\n * library. It can have the following fields:\n *\n * - `debug: boolean`: whether to print the debug information. If this field is\n * not specified, the default value is `false`.\n * - `formats: [string]`: the array of formats of the library. It can be an\n * array of the following values:\n * - `'cjs'`: the CommonJS format.\n * - `'umd'`: the UMD format.\n * - `'esm'`: the ES module format.\n *\n * If this field is not specified, the default value is `['cjs', 'esm']`.\n * - `exports: string`: the export mode to use. It can be one of the following\n * values:\n * - `'auto'`: automatically guesses your intentions based on what the input\n * module exports.\n * - `'default'`: if you are only exporting one thing using `export default ...`;\n * note that this can cause issues when generating CommonJS output that is\n * meant to be interchangeable with ESM output.\n * - `'named'`: if you are using named exports.\n * - `'none'`: if you are not exporting anything (e.g. you are building an\n * app, not a library)\n * - `'mixed'`: if you are using named exports mixed with a default export.\n * Note that this is not a standard exports mode officially supported by\n * the `rollup`, instead, it is an additional mode add by this library.\n *\n * See [output.exports](https://rollupjs.org/configuration-options/#output-exports)\n * for more details. If this field is not specified, the default value is\n * `'auto'`.\n * - `nodeEnv: string`: the value of the `NODE_ENV` environment variable. If\n * this field is not specified, the default value is `process.env.NODE_ENV`.\n * - `minify: boolean`: whether to minify the code. If this field is not\n * specified, and the `nodeEnv` is `production`, the default value is `true`;\n * otherwise the default value is `false`.\n * - `sourcemap: boolean`: whether to generate the source map. If this field is\n * not specified, the default value is `true`.\n * - `input: string`: the input file of the library. If this field is not\n * specified, the default value is `src/index.js`.\n * - `outputDir: string`: the output directory of the library. If this field is\n * not specified, the default value is `dist`.\n * - `filenamePrefix: string`: the prefix of the output filename. If this field\n * is not specified, the default value is the dash case of the library name.\n * For example, if the library name is `MyLibrary`, the default value of this\n * field is `my-library`.\n * - `externals: [string]`: the array of additional external packages, each can\n * be specified with either a string or a regular expression. If this field is\n * not specified, the default value is an empty array.\n * - `useAliasPlugin: boolean`: whether to use the `@rollup/plugin-alias` plugin.\n * If this field is not specified, the default value is `true`.\n * - `aliasPluginOptions: object`: the options for the `@rollup/plugin-alias`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * entries: {\n * 'src': fileURLToPath(new URL('src', importMetaUrl)),\n * },\n * }\n * ```\n * - `useNodeResolvePlugin: boolean`: whether to use the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is `true`.\n * - `nodeResolvePluginOptions: object`: the options for the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is: `{}`.\n * - `useCommonjsPlugin: boolean`: whether to use the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is `true`.\n * - `commonjsPluginOptions: object`: the options for the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * include: ['node_modules/**'],\n * }\n * ```\n * - `useBabelPlugin: boolean`: whether to use the `@rollup/plugin-babel` plugin.\n * If this field is not specified, the default value is `true`.\n * - `babelPluginOptions: object`: the options for the `@rollup/plugin-babel`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * babelHelpers: 'runtime',\n * exclude: ['node_modules/**'],\n * presets: [\n * '@babel/preset-env',\n * ],\n * plugins: [\n * '@babel/plugin-transform-runtime',\n * ],\n * }\n * ```\n * Note that when using the `@rollup/plugin-babel` plugin, you can also specify\n * the configuration of Babel in the standard Babel configuration files,\n * such as `babel.config.js`, `.babelrc`, etc.\n * - `terserOptions: object`: the options for the `@rollup/plugin-terser` plugin.\n * If this field is not specified, the default value is: `{}`. Whether to use\n * the `@rollup/plugin-terser` plugin depends on the `minify` field of the\n * options or the `NODE_ENV` environment variable.\n * - `useAnalyzerPlugin: boolean`: whether to use the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is `true`.\n * - `analyzerOptions: object`: the options for the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * hideDeps: true,\n * limit: 0,\n * summaryOnly: true,\n * }\n * ```\n * - `plugins: [object]`: the array of configuration of additional Rollup\n * plugins. If this field is not specified, the default value is an empty\n * array.\n *\n * @param {string} libraryName\n * The name of the library, which will be used as the name of the global\n * variable in the UMD format. It should in the camel case.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module. It **MUST** be passed\n * with the `import.meta.url` of the caller module.\n * @param {object} options\n * The additional options for building the library, as described above.\n * @returns {Array<object>}\n * the array of Rollup configurations for the library.\n */\nfunction rollupBuilder(libraryName, importMetaUrl, options = {}) {\n const formats = options.formats ?? ['cjs', 'esm'];\n const result = [];\n const input = options.input ?? 'src/index.js';\n for (const format of formats) {\n const clonedOptions = { ...options };\n const output = getRollupOutput(format, libraryName, clonedOptions);\n const external = getRollupExternal(importMetaUrl, clonedOptions);\n const plugins = getRollupPlugins(format, importMetaUrl, clonedOptions);\n const onwarn = getRollupOnWarn();\n const config = { input, output, external, plugins, onwarn };\n result.push(config);\n if (options.debug === true) {\n console.debug(`[DEBUG] The options for the format ${format} is:`);\n console.dir(clonedOptions, { depth: null });\n }\n }\n if (options.debug === true) {\n console.debug('[DEBUG] The generated rollup configurations are:');\n console.dir(result, { depth: null });\n }\n return result;\n}\n\nexport default rollupBuilder;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport rollupBuilder from './rollup-builder.mjs';\n\nexport default rollupBuilder;\n"],"names":["getRollupExternal","importMetaUrl","options","_options$externals","Error","require","createRequire","pkg","peers","_toConsumableArray","Object","keys","peerDependencies","Array","isArray","length","peerPattern","RegExp","concat","join","additions","externals","id","test","_iterator","_createForOfIteratorHelper","_step","s","n","done","pattern","value","String","err","e","f","getRollupOutput","format","libraryName","_options$exports","_options$nodeEnv","_options$minify","_options$filenamePref","_options$outputDir","_options$sourcemap","filenameExt","footer","exports","nodeEnv","process","env","NODE_ENV","minify","camelCaseToDashCase","replace","toLowerCase","filenamePrefix","filenameBase","filename","outputDir","sourcemap","name","file","compact","configAliasPlugin","plugins","_options$useAliasPlug","useAliasPlugin","_options$aliasPluginO","pluginOptions","aliasPluginOptions","entries","fileURLToPath","URL","debug","console","dir","depth","push","alias","configNodeResolvePlugin","_options$useNodeResol","useNodeResolvePlugin","_options$nodeResolveP","nodeResolvePluginOptions","nodeResolve","configCommonJsPlugin","_options$useCommonjsP","useCommonjsPlugin","_options$commonjsPlug","commonjsPluginOptions","include","commonjs","configBabelPlugin","_options$useBabelPlug","useBabelPlugin","_options$babelPluginO","babelPluginOptions","babelHelpers","exclude","presets","modules","babel","configTerserPlugin","_options$terserPlugin","terserPluginOptions","output","comments","keep_classnames","keep_fnames","terser","configAnalyzerPlugin","_options$useAnalyzerP","useAnalyzerPlugin","_options$analyzerPlug","analyzerPluginOptions","hideDeps","limit","summaryOnly","analyzer","configVisualizerPlugin","_options$useVisualize","useVisualizerPlugin","_options$visualizerPl","visualizerPluginOptions","gzipSize","brotliSize","visualizer","getRollupPlugins","json","apply","getRollupOnWarn","onWarn","warning","warn","code","message","includes","rollupBuilder","_options$formats","_options$input","arguments","undefined","formats","result","input","cl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AAoB,IAClCF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,WAAW,CAAC,IACrCJ,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,QAAQ,CAAC,EAAE;AACzC,MAAA;AACF;AACA,IAAA,IAAIJ,OAAO,CAACE,IAAI,KAAK,qBAAqB,IACnCF,OAAO,CAACG,OAAO,CAACC,QAAQ,CAAC,cAAc,CAAC,EAAE;AAC/C,MAAA;AACF;AACA;IACAH,IAAI,CAACD,OAAO,CAAC;GACd;AACH;;;;;;;;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASK,aAAaA,CAACpG,WAAW,EAAErC,aAAa,EAAgB;EAAA,IAAA0I,gBAAA,EAAAC,cAAA;AAAA,EAAA,IAAd1I,OAAO,GAAA2I,SAAA,CAAA9H,MAAA,GAAA,CAAA,IAAA8H,SAAA,CAAA,CAAA,CAAA,KAAAC,SAAA,GAAAD,SAAA,CAAA,CAAA,CAAA,GAAG,EAAE;AAC7D,EAAA,IAAME,OAAO,GAAA,CAAAJ,gBAAA,GAAGzI,OAAO,CAAC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,CAACD,KAAK,CAAA,qCAAA,CAAAxD,MAAA,CAAuCmB,MAAM,SAAM,CAAC;AACjEsC,QAAAA,OAAO,CAACC,GAAG,CAACsE,aAAa,EAAE;AAAErE,UAAAA,KAAK,EAAE;AAAK,SAAC,CAAC;AAC7C;AACF;AAAC,GAAA,CAAA,OAAA5C,GAAA,EAAA;IAAAT,SAAA,CAAAU,CAAA,CAAAD,GAAA,CAAA;AAAA,GAAA,SAAA;AAAAT,IAAAA,SAAA,CAAAW,CAAA,EAAA;AAAA;AACD,EAAA,IAAIjC,OAAO,CAACwE,KAAK,KAAK,IAAI,EAAE;AAC1BC,IAAAA,OAAO,CAACD,KAAK,CAAC,kDAAkD,CAAC;AACjEC,IAAAA,OAAO,CAACC,GAAG,CAACoE,MAAM,EAAE;AAAEnE,MAAAA,KAAK,EAAE;AAAK,KAAC,CAAC;AACtC;AACA,EAAA,OAAOmE,MAAM;AACf;;AC9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup-builder.min.cjs","sources":["../src/get-rollup-external.mjs","../src/get-rollup-output.mjs","../src/get-rollup-plugins.mjs","../src/plugins/config-alias-plugin.mjs","../src/plugins/config-node-resolve-plugin.mjs","../src/plugins/config-common-js-plugin.mjs","../src/plugins/config-babel-plugin.mjs","../src/plugins/config-terser-plugin.mjs","../src/plugins/config-analyzer-plugin.mjs","../src/plugins/config-visualizer-plugin.mjs","../src/rollup-builder.mjs","../src/get-rollup-on-warn.mjs"],"sourcesContent":["////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { createRequire } from 'node:module';\n\n/**\n * Gets Rollup `external` configuration.\n *\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {function}\n * The predicate used as the Rollup `external` configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupExternal(importMetaUrl, options) {\n if (!importMetaUrl) {\n throw new Error('importMetaUrl is required');\n }\n if (!options) {\n throw new Error('options is required');\n }\n // gets all peerDependencies packages from 'package.json' of the caller module\n const require = createRequire(importMetaUrl);\n const pkg = require('./package.json');\n const peers = [...Object.keys(pkg.peerDependencies || {})];\n if (!Array.isArray(peers)) {\n throw new Error('peerDependencies should be an array');\n }\n if (peers.length === 0) {\n return [];\n }\n const peerPattern = (peers ? new RegExp(`^(${peers.join('|')})($|/)`) : null);\n // gets the additional external packages from the user passed options\n const additions = options.externals ?? [];\n // save some configuration to the options object\n options.peers = peers;\n options.peerPattern = peerPattern;\n return (id) => {\n if (peerPattern && peerPattern.test(id)) {\n return true;\n }\n for (const pattern of additions) {\n if ((pattern instanceof RegExp) && pattern.test(id)) {\n return true;\n }\n if (((typeof pattern === 'string') || (pattern instanceof String)) && (pattern === id)) {\n return true;\n }\n }\n return false;\n };\n}\n\nexport default getRollupExternal;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Gets the Rollup `output` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} libraryName\n * The name of the library.\n * @param {object} options\n * The additional options for building the library.\n * @returns {object}\n * The Rollup output configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupOutput(format, libraryName, options) {\n let filenameExt = '';\n let footer = '';\n let exports = options.exports ?? 'auto';\n switch (format) {\n case 'cjs': // drop down\n case 'umd': // drop down\n filenameExt = (format === 'cjs' ? '.cjs' : `.${format}.js`);\n // The following workaround is to solve the following issue: If an ESM\n // module has both default export and named exports, the rollup cannot\n // handle it correctly. For example, the following is a source ESM module:\n // ```js\n // export { Foo, Bar };\n // export default Foo;\n // ```\n // The rollup will translate it into the following codes:\n // ```js\n // exports.Foo = Foo;\n // exports.Bar = Bar;\n // exports.default = Foo;\n // ```\n // However, a common-js consumer will use the module as follows:\n // ```js\n // const Foo = require('my-module');\n // ```\n // which will cause an error. The correct usage should be\n // ```js\n // const Foo = require('my-module').default\n // ```\n // But unfortunately, the rollup will translate the ESM default import as\n // follows:\n // ```js\n // import Foo from 'my-module';\n // ```\n // will be translated by rollup to\n // ```js\n // const Foo = require('my-module');\n // ```\n // Note that the above translation has no `.default` suffix, which will\n // cause an error.\n //\n // The workaround is copied from the source code of the official rollup\n // plugins:\n // https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n // It adds a simple footer statements to each `CJS` format bundle:\n // ```js\n // module.exports = Object.assign(exports.default, exports);\n // ```\n //\n // See:\n // [1] https://rollupjs.org/configuration-options/#output-exports\n // [2] https://github.com/rollup/rollup/issues/1961\n // [3] https://stackoverflow.com/questions/58246998/mixing-default-and-named-exports-with-rollup\n // [4] https://github.com/avisek/rollup-patch-seamless-default-export\n // [5] https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n if (exports === 'mixed') {\n exports = 'named';\n footer = 'module.exports = Object.assign(exports.default, exports);';\n }\n break;\n case 'amd': // drop down\n case 'iife':\n filenameExt = `.${format}.js`;\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n case 'es': // drop down\n case 'esm': // drop down\n case 'module':\n format = 'es';\n filenameExt = '.mjs';\n // fix the exports, because the ESM format does not support the 'mixed' exports mode\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n default:\n throw new Error(`Unsupported library format: ${format}`);\n }\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n const camelCaseToDashCase = (s) => s.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n const filenamePrefix = options.filenamePrefix ?? camelCaseToDashCase(libraryName);\n const filenameBase = `${filenamePrefix}${minify ? '.min' : ''}`;\n const filename = `${filenameBase}${filenameExt}`;\n const outputDir = options.outputDir ?? 'dist';\n const sourcemap = options.sourcemap ?? true;\n // save some configuration to the options object\n options.format = format;\n options.name = libraryName;\n options.minify = minify;\n options.filenamePrefix = filenamePrefix;\n options.filenameBase = filenameBase;\n options.filenameExt = filenameExt;\n options.filename = filename;\n options.exports = exports;\n options.sourcemap = sourcemap;\n options.outputDir = outputDir;\n return {\n name: libraryName,\n file: `${outputDir}/${filename}`,\n format,\n exports,\n footer,\n sourcemap,\n compact: minify,\n };\n}\n\nexport default getRollupOutput;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport json from '@rollup/plugin-json';\nimport configAliasPlugin from './plugins/config-alias-plugin.mjs';\nimport configNodeResolvePlugin from './plugins/config-node-resolve-plugin.mjs';\nimport configCommonJsPlugin from './plugins/config-common-js-plugin.mjs';\nimport configBabelPlugin from './plugins/config-babel-plugin.mjs';\nimport configTerserPlugin from './plugins/config-terser-plugin.mjs';\nimport configAnalyzerPlugin from './plugins/config-analyzer-plugin.mjs';\nimport configVisualizerPlugin from './plugins/config-visualizer-plugin.mjs';\n\n/**\n * Gets Rollup `plugins` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {Array<Object>}\n * The Rollup plugins array.\n * @author Haixing Hu\n */\nfunction getRollupPlugins(format, importMetaUrl, options) {\n const plugins = [];\n plugins.push(json());\n configAliasPlugin(format, importMetaUrl, options, plugins);\n configNodeResolvePlugin(format, importMetaUrl, options, plugins);\n configCommonJsPlugin(format, importMetaUrl, options, plugins);\n configBabelPlugin(format, importMetaUrl, options, plugins);\n configTerserPlugin(format, importMetaUrl, options, plugins);\n configAnalyzerPlugin(format, importMetaUrl, options, plugins);\n configVisualizerPlugin(format, importMetaUrl, options, plugins);\n // The user can specify additional plugins.\n if (options.plugins) {\n plugins.push(...options.plugins);\n }\n return plugins;\n}\n\nexport default getRollupPlugins;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { fileURLToPath } from 'node:url';\nimport alias from '@rollup/plugin-alias';\n\n/**\n * Configures the `@rollup/plugin-alias` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-alias\n */\nfunction configAliasPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAliasPlugin ?? true) {\n // The @rollup/plugin-alias enables us to use absolute import paths for\n // \"src\" (or any other path you want to configure).\n const pluginOptions = options.aliasPluginOptions ?? {\n entries: {\n 'src': fileURLToPath(new URL('src', importMetaUrl)),\n },\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-alias plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(alias(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAliasPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport nodeResolve from '@rollup/plugin-node-resolve';\n\n/**\n * Configures the `@rollup/plugin-node-resolve` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-node-resolve\n */\nfunction configNodeResolvePlugin(format, importMetaUrl, options, plugins) {\n if (options.useNodeResolvePlugin ?? true) {\n // The @rollup/plugin-node-resolve allows Rollup to resolve external\n // modules from node_modules:\n const pluginOptions = options.nodeResolvePluginOptions ?? {};\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-node-resolve plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(nodeResolve(pluginOptions));\n }\n return plugins;\n}\n\nexport default configNodeResolvePlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport commonjs from '@rollup/plugin-commonjs';\n\n/**\n * Configures the `@rollup/plugin-commonjs` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-commonjs\n */\nfunction configCommonJsPlugin(format, importMetaUrl, options, plugins) {\n if (options.useCommonjsPlugin ?? true) {\n // The @rollup/plugin-commonjs plugin converts 3rd-party CommonJS modules\n // into ES6 code, so that they can be included in our Rollup bundle.\n // When using @rollup/plugin-babel with @rollup/plugin-commonjs in the\n // same Rollup configuration, it's important to note that\n // @rollup/plugin-commonjs must be placed before this plugin in the\n // plugins array for the two to work together properly.\n const pluginOptions = options.commonjsPluginOptions ?? {\n include: ['node_modules/**'],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-commonjs plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(commonjs(pluginOptions));\n }\n return plugins;\n}\n\nexport default configCommonJsPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport babel from '@rollup/plugin-babel';\n\n/**\n * Configures the `@rollup/plugin-babel` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-babel\n */\nfunction configBabelPlugin(format, importMetaUrl, options, plugins) {\n if (options.useBabelPlugin ?? true) {\n const pluginOptions = options.babelPluginOptions ?? {\n babelHelpers: 'runtime',\n exclude: ['node_modules/**'],\n presets: [\n // The @babel/preset-env preset enables Babel to transpile ES6+ code\n // and the rollup requires that Babel keeps ES6 module syntax intact.\n ['@babel/preset-env', { modules: false }],\n ],\n plugins: [\n '@babel/plugin-transform-runtime',\n ],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-babel plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(babel(pluginOptions));\n }\n return plugins;\n}\n\nexport default configBabelPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport terser from '@rollup/plugin-terser';\n\n/**\n * Configures the `@rollup/plugin-terser` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-terser\n */\nfunction configTerserPlugin(format, importMetaUrl, options, plugins) {\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n if (minify) {\n // The @rollup/plugin-terser uses terser under the hood to minify the code.\n const pluginOptions = options.terserPluginOptions ?? {\n output: {\n comments: false, // default to remove all comments\n },\n keep_classnames: true, // keep the class names\n keep_fnames: true, // keep the function names\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-terser plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(terser(pluginOptions));\n }\n return plugins;\n}\n\nexport default configTerserPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport analyzer from 'rollup-plugin-analyzer';\n\n/**\n * Configures the `rollup-plugin-analyzer` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-analyzer\n */\nfunction configAnalyzerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAnalyzerPlugin ?? true) {\n // The rollup-plugin-analyzer will print out some useful info about our\n // generated bundle upon successful builds.\n const pluginOptions = options.analyzerPluginOptions ?? {\n hideDeps: true,\n limit: 0,\n summaryOnly: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-analyzer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(analyzer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAnalyzerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { visualizer } from 'rollup-plugin-visualizer';\n\n/**\n * Configures the `rollup-plugin-visualizer` plugin.\n *\n * The `rollup-plugin-visualizer` will visualize and analyze your Rollup\n * bundle to see which modules are taking up space.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-visualizer\n */\nfunction configVisualizerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useVisualizerPlugin ?? true) {\n // The rollup-plugin-visualizer will visualize and analyze your Rollup\n // bundle to see which modules are taking up space.\n const pluginOptions = options.visualizerPluginOptions ?? {\n filename: `./doc/${options.filenameBase}.visualization.html`,\n gzipSize: true,\n brotliSize: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-visualizer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(visualizer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configVisualizerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport getRollupExternal from './get-rollup-external.mjs';\nimport getRollupOutput from './get-rollup-output.mjs';\nimport getRollupPlugins from './get-rollup-plugins.mjs';\nimport getRollupOnWarn from './get-rollup-on-warn.mjs';\n\n/**\n * Builds the Rollup configuration for a library.\n *\n * The function could be provided with an additional options for building the\n * library. It can have the following fields:\n *\n * - `debug: boolean`: whether to print the debug information. If this field is\n * not specified, the default value is `false`.\n * - `formats: [string]`: the array of formats of the library. It can be an\n * array of the following values:\n * - `'cjs'`: the CommonJS format.\n * - `'umd'`: the UMD format.\n * - `'esm'`: the ES module format.\n *\n * If this field is not specified, the default value is `['cjs', 'esm']`.\n * - `exports: string`: the export mode to use. It can be one of the following\n * values:\n * - `'auto'`: automatically guesses your intentions based on what the input\n * module exports.\n * - `'default'`: if you are only exporting one thing using `export default ...`;\n * note that this can cause issues when generating CommonJS output that is\n * meant to be interchangeable with ESM output.\n * - `'named'`: if you are using named exports.\n * - `'none'`: if you are not exporting anything (e.g. you are building an\n * app, not a library)\n * - `'mixed'`: if you are using named exports mixed with a default export.\n * Note that this is not a standard exports mode officially supported by\n * the `rollup`, instead, it is an additional mode add by this library.\n *\n * See [output.exports](https://rollupjs.org/configuration-options/#output-exports)\n * for more details. If this field is not specified, the default value is\n * `'auto'`.\n * - `nodeEnv: string`: the value of the `NODE_ENV` environment variable. If\n * this field is not specified, the default value is `process.env.NODE_ENV`.\n * - `minify: boolean`: whether to minify the code. If this field is not\n * specified, and the `nodeEnv` is `production`, the default value is `true`;\n * otherwise the default value is `false`.\n * - `sourcemap: boolean`: whether to generate the source map. If this field is\n * not specified, the default value is `true`.\n * - `input: string`: the input file of the library. If this field is not\n * specified, the default value is `src/index.js`.\n * - `outputDir: string`: the output directory of the library. If this field is\n * not specified, the default value is `dist`.\n * - `filenamePrefix: string`: the prefix of the output filename. If this field\n * is not specified, the default value is the dash case of the library name.\n * For example, if the library name is `MyLibrary`, the default value of this\n * field is `my-library`.\n * - `externals: [string]`: the array of additional external packages, each can\n * be specified with either a string or a regular expression. If this field is\n * not specified, the default value is an empty array.\n * - `useAliasPlugin: boolean`: whether to use the `@rollup/plugin-alias` plugin.\n * If this field is not specified, the default value is `true`.\n * - `aliasPluginOptions: object`: the options for the `@rollup/plugin-alias`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * entries: {\n * 'src': fileURLToPath(new URL('src', importMetaUrl)),\n * },\n * }\n * ```\n * - `useNodeResolvePlugin: boolean`: whether to use the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is `true`.\n * - `nodeResolvePluginOptions: object`: the options for the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is: `{}`.\n * - `useCommonjsPlugin: boolean`: whether to use the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is `true`.\n * - `commonjsPluginOptions: object`: the options for the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * include: ['node_modules/**'],\n * }\n * ```\n * - `useBabelPlugin: boolean`: whether to use the `@rollup/plugin-babel` plugin.\n * If this field is not specified, the default value is `true`.\n * - `babelPluginOptions: object`: the options for the `@rollup/plugin-babel`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * babelHelpers: 'runtime',\n * exclude: ['node_modules/**'],\n * presets: [\n * '@babel/preset-env',\n * ],\n * plugins: [\n * '@babel/plugin-transform-runtime',\n * ],\n * }\n * ```\n * Note that when using the `@rollup/plugin-babel` plugin, you can also specify\n * the configuration of Babel in the standard Babel configuration files,\n * such as `babel.config.js`, `.babelrc`, etc.\n * - `terserOptions: object`: the options for the `@rollup/plugin-terser` plugin.\n * If this field is not specified, the default value is: `{}`. Whether to use\n * the `@rollup/plugin-terser` plugin depends on the `minify` field of the\n * options or the `NODE_ENV` environment variable.\n * - `useAnalyzerPlugin: boolean`: whether to use the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is `true`.\n * - `analyzerOptions: object`: the options for the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * hideDeps: true,\n * limit: 0,\n * summaryOnly: true,\n * }\n * ```\n * - `plugins: [object]`: the array of configuration of additional Rollup\n * plugins. If this field is not specified, the default value is an empty\n * array.\n *\n * @param {string} libraryName\n * The name of the library, which will be used as the name of the global\n * variable in the UMD format. It should in the camel case.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module. It **MUST** be passed\n * with the `import.meta.url` of the caller module.\n * @param {object} options\n * The additional options for building the library, as described above.\n * @returns {Array<object>}\n * the array of Rollup configurations for the library.\n */\nfunction rollupBuilder(libraryName, importMetaUrl, options = {}) {\n const formats = options.formats ?? ['cjs', 'esm'];\n const result = [];\n const input = options.input ?? 'src/index.js';\n for (const format of formats) {\n const clonedOptions = { ...options };\n const output = getRollupOutput(format, libraryName, clonedOptions);\n const external = getRollupExternal(importMetaUrl, clonedOptions);\n const plugins = getRollupPlugins(format, importMetaUrl, clonedOptions);\n const onwarn = getRollupOnWarn();\n const config = { input, output, external, plugins, onwarn };\n result.push(config);\n if (options.debug === true) {\n console.debug(`[DEBUG] The options for the format ${format} is:`);\n console.dir(clonedOptions, { depth: null });\n }\n }\n if (options.debug === true) {\n console.debug('[DEBUG] The generated rollup configurations are:');\n console.dir(result, { depth: null });\n }\n return result;\n}\n\nexport default rollupBuilder;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2024.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\nfunction getRollupOnWarn() {\n return function onWarn(warning, warn) {\n // skip certain warnings\n if (warning.code === 'INVALID_ANNOTATION'\n && warning.message.includes('#__PURE__')\n && warning.message.includes('terser')) {\n return;\n }\n if (warning.code === 'CIRCULAR_DEPENDENCY'\n && warning.message.includes('node_modules')) {\n return;\n }\n // Use default for everything else\n warn(warning);\n };\n}\n\nexport default getRollupOnWarn;\n"],"names":["getRollupExternal","importMetaUrl","options","_options$externals","Error","pkg","createRequire","require","peers","_toConsumableArray","Object","keys","peerDependencies","Array","isArray","length","peerPattern","RegExp","concat","join","additions","externals","id","test","_step","_iterator","_createForOfIteratorHelper","s","n","done","pattern","value","String","err","e","f","getRollupOutput","format","libraryName","_options$exports","_options$nodeEnv","_options$minify","_options$filenamePref","_options$outputDir","_options$sourcemap","filenameExt","footer","exports","nodeEnv","process","env","NODE_ENV","minify","filenamePrefix","camelCaseToDashCase","replace","toLowerCase","filenameBase","filename","outputDir","sourcemap","name","file","compact","getRollupPlugins","plugins","push","json","configAliasPlugin","_options$useAliasPlug","useAliasPlugin","_options$aliasPluginO","pluginOptions","aliasPluginOptions","entries","src","fileURLToPath","URL","debug","console","dir","depth","alias","configNodeResolvePlugin","_options$useNodeResol","useNodeResolvePlugin","_options$nodeResolveP","nodeResolvePluginOptions","nodeResolve","configCommonJsPlugin","_options$useCommonjsP","useCommonjsPlugin","_options$commonjsPlug","commonjsPluginOptions","include","commonjs","configBabelPlugin","_options$useBabelPlug","useBabelPlugin","_options$babelPluginO","babelPluginOptions","babelHelpers","exclude","presets","modules","babel","configTerserPlugin","_options$terserPlugin","terserPluginOptions","output","comments","keep_classnames","keep_fnames","terser","configAnalyzerPlugin","_options$useAnalyzerP","useAnalyzerPlugin","_options$analyzerPlug","analyzerPluginOptions","hideDeps","limit","summaryOnly","analyzer","configVisualizerPlugin","_options$useVisualize","useVisualizerPlugin","_options$visualizerPl","visualizerPluginOptions","gzipSize","brotliSize","visualizer","apply","rollupBuilder","_options$formats","_options$input","arguments","undefined","formats","result","input","clonedOptions","_objectSpread","config","external","onwarn","onWarn","warning","warn","code","message","includes"],"mappings":"6hDAqBA,SAASA,kBAAkBC,EAAeC,GAAS,IAAAC,EACjD,IAAKF,EACH,MAAM,IAAIG,MAAM,6BAElB,IAAKF,EACH,MAAM,IAAIE,MAAM,uBAGlB,IACMC,EADUC,EAAaA,cAACL,EAClBM,CAAQ,kBACdC,EAAKC,EAAOC,OAAOC,KAAKN,EAAIO,kBAAoB,CAAA,IACtD,IAAKC,MAAMC,QAAQN,GACjB,MAAM,IAAIJ,MAAM,uCAElB,GAAqB,IAAjBI,EAAMO,OACR,MAAO,GAET,IAAMC,EAAeR,EAAQ,IAAIS,YAAMC,OAAMV,EAAMW,KAAK,KAAY,WAAI,KAElEC,EAA6B,QAApBjB,EAAGD,EAAQmB,iBAAS,IAAAlB,EAAAA,EAAI,GAIvC,OAFAD,EAAQM,MAAQA,EAChBN,EAAQc,YAAcA,EACf,SAACM,GACN,GAAIN,GAAeA,EAAYO,KAAKD,GAClC,OAAO,EACR,IAC8BE,EAD9BC,EAAAC,6BACqBN,GAAS,IAA/B,IAAAK,EAAAE,MAAAH,EAAAC,EAAAG,KAAAC,MAAiC,CAAA,IAA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AAAR,EAAAU,GAAA,CAKD,OAJsB,IAAlBjC,EAAQ4E,QACVC,QAAQD,MAAM,oDACdC,QAAQC,IAAI0D,EAAQ,CAAEzD,MAAO,QAExByD,CACT"}
|
|
1
|
+
{"version":3,"file":"rollup-builder.min.cjs","sources":["../src/get-rollup-external.mjs","../src/get-rollup-output.mjs","../src/get-rollup-plugins.mjs","../src/plugins/config-alias-plugin.mjs","../src/plugins/config-node-resolve-plugin.mjs","../src/plugins/config-common-js-plugin.mjs","../src/plugins/config-babel-plugin.mjs","../src/plugins/config-terser-plugin.mjs","../src/plugins/config-analyzer-plugin.mjs","../src/plugins/config-visualizer-plugin.mjs","../src/rollup-builder.mjs","../src/get-rollup-on-warn.mjs"],"sourcesContent":["////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { createRequire } from 'node:module';\n\n/**\n * Gets Rollup `external` configuration.\n *\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {function}\n * The predicate used as the Rollup `external` configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupExternal(importMetaUrl, options) {\n if (!importMetaUrl) {\n throw new Error('importMetaUrl is required');\n }\n if (!options) {\n throw new Error('options is required');\n }\n // gets all peerDependencies packages from 'package.json' of the caller module\n const require = createRequire(importMetaUrl);\n const pkg = require('./package.json');\n const peers = [...Object.keys(pkg.peerDependencies || {})];\n if (!Array.isArray(peers)) {\n throw new Error('peerDependencies should be an array');\n }\n if (peers.length === 0) {\n return [];\n }\n const peerPattern = (peers ? new RegExp(`^(${peers.join('|')})($|/)`) : null);\n // gets the additional external packages from the user passed options\n const additions = options.externals ?? [];\n // save some configuration to the options object\n options.peers = peers;\n options.peerPattern = peerPattern;\n return (id) => {\n if (peerPattern && peerPattern.test(id)) {\n return true;\n }\n for (const pattern of additions) {\n if ((pattern instanceof RegExp) && pattern.test(id)) {\n return true;\n }\n if (((typeof pattern === 'string') || (pattern instanceof String)) && (pattern === id)) {\n return true;\n }\n }\n return false;\n };\n}\n\nexport default getRollupExternal;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Gets the Rollup `output` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} libraryName\n * The name of the library.\n * @param {object} options\n * The additional options for building the library.\n * @returns {object}\n * The Rollup output configuration for the library.\n * @author Haixing Hu\n */\nfunction getRollupOutput(format, libraryName, options) {\n let filenameExt = '';\n let footer = '';\n let exports = options.exports ?? 'auto';\n switch (format) {\n case 'cjs': // drop down\n case 'umd': // drop down\n filenameExt = (format === 'cjs' ? '.cjs' : `.${format}.js`);\n // The following workaround is to solve the following issue: If an ESM\n // module has both default export and named exports, the rollup cannot\n // handle it correctly. For example, the following is a source ESM module:\n // ```js\n // export { Foo, Bar };\n // export default Foo;\n // ```\n // The rollup will translate it into the following codes:\n // ```js\n // exports.Foo = Foo;\n // exports.Bar = Bar;\n // exports.default = Foo;\n // ```\n // However, a common-js consumer will use the module as follows:\n // ```js\n // const Foo = require('my-module');\n // ```\n // which will cause an error. The correct usage should be\n // ```js\n // const Foo = require('my-module').default\n // ```\n // But unfortunately, the rollup will translate the ESM default import as\n // follows:\n // ```js\n // import Foo from 'my-module';\n // ```\n // will be translated by rollup to\n // ```js\n // const Foo = require('my-module');\n // ```\n // Note that the above translation has no `.default` suffix, which will\n // cause an error.\n //\n // The workaround is copied from the source code of the official rollup\n // plugins:\n // https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n // It adds a simple footer statements to each `CJS` format bundle:\n // ```js\n // module.exports = Object.assign(exports.default, exports);\n // ```\n //\n // See:\n // [1] https://rollupjs.org/configuration-options/#output-exports\n // [2] https://github.com/rollup/rollup/issues/1961\n // [3] https://stackoverflow.com/questions/58246998/mixing-default-and-named-exports-with-rollup\n // [4] https://github.com/avisek/rollup-patch-seamless-default-export\n // [5] https://github.com/rollup/plugins/blob/master/shared/rollup.config.mjs\n //\n if (exports === 'mixed') {\n exports = 'named';\n footer = 'module.exports = Object.assign(exports.default, exports);';\n }\n break;\n case 'amd': // drop down\n case 'iife':\n filenameExt = `.${format}.js`;\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n case 'es': // drop down\n case 'esm': // drop down\n case 'module':\n format = 'es';\n filenameExt = '.mjs';\n // fix the exports, because the ESM format does not support the 'mixed' exports mode\n if (exports === 'mixed') {\n exports = 'auto';\n }\n break;\n default:\n throw new Error(`Unsupported library format: ${format}`);\n }\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n const camelCaseToDashCase = (s) => s.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n const filenamePrefix = options.filenamePrefix ?? camelCaseToDashCase(libraryName);\n const filenameBase = `${filenamePrefix}${minify ? '.min' : ''}`;\n const filename = `${filenameBase}${filenameExt}`;\n const outputDir = options.outputDir ?? 'dist';\n const sourcemap = options.sourcemap ?? true;\n // save some configuration to the options object\n options.format = format;\n options.name = libraryName;\n options.minify = minify;\n options.filenamePrefix = filenamePrefix;\n options.filenameBase = filenameBase;\n options.filenameExt = filenameExt;\n options.filename = filename;\n options.exports = exports;\n options.sourcemap = sourcemap;\n options.outputDir = outputDir;\n return {\n name: libraryName,\n file: `${outputDir}/${filename}`,\n format,\n exports,\n footer,\n sourcemap,\n compact: minify,\n };\n}\n\nexport default getRollupOutput;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport json from '@rollup/plugin-json';\nimport configAliasPlugin from './plugins/config-alias-plugin.mjs';\nimport configNodeResolvePlugin from './plugins/config-node-resolve-plugin.mjs';\nimport configCommonJsPlugin from './plugins/config-common-js-plugin.mjs';\nimport configBabelPlugin from './plugins/config-babel-plugin.mjs';\nimport configTerserPlugin from './plugins/config-terser-plugin.mjs';\nimport configAnalyzerPlugin from './plugins/config-analyzer-plugin.mjs';\nimport configVisualizerPlugin from './plugins/config-visualizer-plugin.mjs';\n\n/**\n * Gets Rollup `plugins` configuration.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @returns {Array<Object>}\n * The Rollup plugins array.\n * @author Haixing Hu\n */\nfunction getRollupPlugins(format, importMetaUrl, options) {\n const plugins = [];\n plugins.push(json());\n configAliasPlugin(format, importMetaUrl, options, plugins);\n configNodeResolvePlugin(format, importMetaUrl, options, plugins);\n configCommonJsPlugin(format, importMetaUrl, options, plugins);\n configBabelPlugin(format, importMetaUrl, options, plugins);\n configTerserPlugin(format, importMetaUrl, options, plugins);\n configAnalyzerPlugin(format, importMetaUrl, options, plugins);\n configVisualizerPlugin(format, importMetaUrl, options, plugins);\n // The user can specify additional plugins.\n if (options.plugins) {\n plugins.push(...options.plugins);\n }\n return plugins;\n}\n\nexport default getRollupPlugins;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { fileURLToPath } from 'node:url';\nimport alias from '@rollup/plugin-alias';\n\n/**\n * Configures the `@rollup/plugin-alias` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-alias\n */\nfunction configAliasPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAliasPlugin ?? true) {\n // The @rollup/plugin-alias enables us to use absolute import paths for\n // \"src\" (or any other path you want to configure).\n const pluginOptions = options.aliasPluginOptions ?? {\n entries: {\n 'src': fileURLToPath(new URL('src', importMetaUrl)),\n },\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-alias plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(alias(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAliasPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport nodeResolve from '@rollup/plugin-node-resolve';\n\n/**\n * Configures the `@rollup/plugin-node-resolve` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-node-resolve\n */\nfunction configNodeResolvePlugin(format, importMetaUrl, options, plugins) {\n if (options.useNodeResolvePlugin ?? true) {\n // The @rollup/plugin-node-resolve allows Rollup to resolve external\n // modules from node_modules:\n const pluginOptions = options.nodeResolvePluginOptions ?? {};\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-node-resolve plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(nodeResolve(pluginOptions));\n }\n return plugins;\n}\n\nexport default configNodeResolvePlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport commonjs from '@rollup/plugin-commonjs';\n\n/**\n * Configures the `@rollup/plugin-commonjs` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array<Object>} plugins\n * The Rollup plugins array.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-commonjs\n */\nfunction configCommonJsPlugin(format, importMetaUrl, options, plugins) {\n if (options.useCommonjsPlugin ?? true) {\n // The @rollup/plugin-commonjs plugin converts 3rd-party CommonJS modules\n // into ES6 code, so that they can be included in our Rollup bundle.\n // When using @rollup/plugin-babel with @rollup/plugin-commonjs in the\n // same Rollup configuration, it's important to note that\n // @rollup/plugin-commonjs must be placed before this plugin in the\n // plugins array for the two to work together properly.\n const pluginOptions = options.commonjsPluginOptions ?? {\n include: ['node_modules/**'],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-commonjs plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(commonjs(pluginOptions));\n }\n return plugins;\n}\n\nexport default configCommonJsPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport babel from '@rollup/plugin-babel';\n\n/**\n * Configures the `@rollup/plugin-babel` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-babel\n */\nfunction configBabelPlugin(format, importMetaUrl, options, plugins) {\n if (options.useBabelPlugin ?? true) {\n const pluginOptions = options.babelPluginOptions ?? {\n babelHelpers: 'runtime',\n exclude: ['node_modules/**'],\n presets: [\n // The @babel/preset-env preset enables Babel to transpile ES6+ code\n // and the rollup requires that Babel keeps ES6 module syntax intact.\n ['@babel/preset-env', { modules: false }],\n ],\n plugins: [\n '@babel/plugin-transform-runtime',\n ],\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-babel plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(babel(pluginOptions));\n }\n return plugins;\n}\n\nexport default configBabelPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport terser from '@rollup/plugin-terser';\n\n/**\n * Configures the `@rollup/plugin-terser` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/@rollup/plugin-terser\n */\nfunction configTerserPlugin(format, importMetaUrl, options, plugins) {\n const nodeEnv = options.nodeEnv ?? process.env.NODE_ENV;\n const minify = options.minify ?? (nodeEnv === 'production');\n if (minify) {\n // The @rollup/plugin-terser uses terser under the hood to minify the code.\n const pluginOptions = options.terserPluginOptions ?? {\n output: {\n comments: false, // default to remove all comments\n },\n keep_classnames: true, // keep the class names\n keep_fnames: true, // keep the function names\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The @rollup/plugin-terser plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(terser(pluginOptions));\n }\n return plugins;\n}\n\nexport default configTerserPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport analyzer from 'rollup-plugin-analyzer';\n\n/**\n * Configures the `rollup-plugin-analyzer` plugin.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-analyzer\n */\nfunction configAnalyzerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useAnalyzerPlugin ?? true) {\n // The rollup-plugin-analyzer will print out some useful info about our\n // generated bundle upon successful builds.\n const pluginOptions = options.analyzerPluginOptions ?? {\n hideDeps: true,\n limit: 0,\n summaryOnly: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-analyzer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(analyzer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configAnalyzerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport { visualizer } from 'rollup-plugin-visualizer';\n\n/**\n * Configures the `rollup-plugin-visualizer` plugin.\n *\n * The `rollup-plugin-visualizer` will visualize and analyze your Rollup\n * bundle to see which modules are taking up space.\n *\n * @param {string} format\n * The format of the library.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module.\n * @param {object} options\n * The additional options for building the library.\n * @param {Array} plugins\n * The array of Rollup plugins.\n * @returns {Array<Object>}\n * The modified Rollup plugins array.\n * @author Haixing Hu\n * @see https://www.npmjs.com/package/rollup-plugin-visualizer\n */\nfunction configVisualizerPlugin(format, importMetaUrl, options, plugins) {\n if (options.useVisualizerPlugin ?? true) {\n // The rollup-plugin-visualizer will visualize and analyze your Rollup\n // bundle to see which modules are taking up space.\n const pluginOptions = options.visualizerPluginOptions ?? {\n filename: `./doc/${options.filenameBase}.visualization.html`,\n gzipSize: true,\n brotliSize: true,\n };\n if (options.debug === true) {\n console.debug('[DEBUG] The rollup-plugin-visualizer plugin options are:');\n console.dir(pluginOptions, { depth: null });\n }\n plugins.push(visualizer(pluginOptions));\n }\n return plugins;\n}\n\nexport default configVisualizerPlugin;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2023.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\nimport getRollupExternal from './get-rollup-external.mjs';\nimport getRollupOutput from './get-rollup-output.mjs';\nimport getRollupPlugins from './get-rollup-plugins.mjs';\nimport getRollupOnWarn from './get-rollup-on-warn.mjs';\n\n/**\n * Builds the Rollup configuration for a library.\n *\n * The function could be provided with an additional options for building the\n * library. It can have the following fields:\n *\n * - `debug: boolean`: whether to print the debug information. If this field is\n * not specified, the default value is `false`.\n * - `formats: [string]`: the array of formats of the library. It can be an\n * array of the following values:\n * - `'cjs'`: the CommonJS format.\n * - `'umd'`: the UMD format.\n * - `'esm'`: the ES module format.\n *\n * If this field is not specified, the default value is `['cjs', 'esm']`.\n * - `exports: string`: the export mode to use. It can be one of the following\n * values:\n * - `'auto'`: automatically guesses your intentions based on what the input\n * module exports.\n * - `'default'`: if you are only exporting one thing using `export default ...`;\n * note that this can cause issues when generating CommonJS output that is\n * meant to be interchangeable with ESM output.\n * - `'named'`: if you are using named exports.\n * - `'none'`: if you are not exporting anything (e.g. you are building an\n * app, not a library)\n * - `'mixed'`: if you are using named exports mixed with a default export.\n * Note that this is not a standard exports mode officially supported by\n * the `rollup`, instead, it is an additional mode add by this library.\n *\n * See [output.exports](https://rollupjs.org/configuration-options/#output-exports)\n * for more details. If this field is not specified, the default value is\n * `'auto'`.\n * - `nodeEnv: string`: the value of the `NODE_ENV` environment variable. If\n * this field is not specified, the default value is `process.env.NODE_ENV`.\n * - `minify: boolean`: whether to minify the code. If this field is not\n * specified, and the `nodeEnv` is `production`, the default value is `true`;\n * otherwise the default value is `false`.\n * - `sourcemap: boolean`: whether to generate the source map. If this field is\n * not specified, the default value is `true`.\n * - `input: string`: the input file of the library. If this field is not\n * specified, the default value is `src/index.js`.\n * - `outputDir: string`: the output directory of the library. If this field is\n * not specified, the default value is `dist`.\n * - `filenamePrefix: string`: the prefix of the output filename. If this field\n * is not specified, the default value is the dash case of the library name.\n * For example, if the library name is `MyLibrary`, the default value of this\n * field is `my-library`.\n * - `externals: [string]`: the array of additional external packages, each can\n * be specified with either a string or a regular expression. If this field is\n * not specified, the default value is an empty array.\n * - `useAliasPlugin: boolean`: whether to use the `@rollup/plugin-alias` plugin.\n * If this field is not specified, the default value is `true`.\n * - `aliasPluginOptions: object`: the options for the `@rollup/plugin-alias`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * entries: {\n * 'src': fileURLToPath(new URL('src', importMetaUrl)),\n * },\n * }\n * ```\n * - `useNodeResolvePlugin: boolean`: whether to use the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is `true`.\n * - `nodeResolvePluginOptions: object`: the options for the `@rollup/plugin-node-resolve`\n * plugin. If this field is not specified, the default value is: `{}`.\n * - `useCommonjsPlugin: boolean`: whether to use the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is `true`.\n * - `commonjsPluginOptions: object`: the options for the `@rollup/plugin-commonjs`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * include: ['node_modules/**'],\n * }\n * ```\n * - `useBabelPlugin: boolean`: whether to use the `@rollup/plugin-babel` plugin.\n * If this field is not specified, the default value is `true`.\n * - `babelPluginOptions: object`: the options for the `@rollup/plugin-babel`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * babelHelpers: 'runtime',\n * exclude: ['node_modules/**'],\n * presets: [\n * '@babel/preset-env',\n * ],\n * plugins: [\n * '@babel/plugin-transform-runtime',\n * ],\n * }\n * ```\n * Note that when using the `@rollup/plugin-babel` plugin, you can also specify\n * the configuration of Babel in the standard Babel configuration files,\n * such as `babel.config.js`, `.babelrc`, etc.\n * - `terserOptions: object`: the options for the `@rollup/plugin-terser` plugin.\n * If this field is not specified, the default value is: `{}`. Whether to use\n * the `@rollup/plugin-terser` plugin depends on the `minify` field of the\n * options or the `NODE_ENV` environment variable.\n * - `useAnalyzerPlugin: boolean`: whether to use the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is `true`.\n * - `analyzerOptions: object`: the options for the `rollup-plugin-analyzer`\n * plugin. If this field is not specified, the default value is:\n * ```js\n * {\n * hideDeps: true,\n * limit: 0,\n * summaryOnly: true,\n * }\n * ```\n * - `plugins: [object]`: the array of configuration of additional Rollup\n * plugins. If this field is not specified, the default value is an empty\n * array.\n *\n * @param {string} libraryName\n * The name of the library, which will be used as the name of the global\n * variable in the UMD format. It should in the camel case.\n * @param {string} importMetaUrl\n * The URL of the `import.meta` of the caller module. It **MUST** be passed\n * with the `import.meta.url` of the caller module.\n * @param {object} options\n * The additional options for building the library, as described above.\n * @returns {Array<object>}\n * the array of Rollup configurations for the library.\n */\nfunction rollupBuilder(libraryName, importMetaUrl, options = {}) {\n const formats = options.formats ?? ['cjs', 'esm'];\n const result = [];\n const input = options.input ?? 'src/index.js';\n for (const format of formats) {\n const clonedOptions = { ...options };\n const output = getRollupOutput(format, libraryName, clonedOptions);\n const external = getRollupExternal(importMetaUrl, clonedOptions);\n const plugins = getRollupPlugins(format, importMetaUrl, clonedOptions);\n const onwarn = getRollupOnWarn();\n const config = { input, output, external, plugins, onwarn };\n result.push(config);\n if (options.debug === true) {\n console.debug(`[DEBUG] The options for the format ${format} is:`);\n console.dir(clonedOptions, { depth: null });\n }\n }\n if (options.debug === true) {\n console.debug('[DEBUG] The generated rollup configurations are:');\n console.dir(result, { depth: null });\n }\n return result;\n}\n\nexport default rollupBuilder;\n","////////////////////////////////////////////////////////////////////////////////\n//\n// Copyright (c) 2022 - 2024.\n// Haixing Hu, Qubit Co. Ltd.\n//\n// All rights reserved.\n//\n////////////////////////////////////////////////////////////////////////////////\n\nfunction getRollupOnWarn() {\n return function onWarn(warning, warn) {\n // skip certain warnings\n if (warning.code === 'INVALID_ANNOTATION'\n && warning.message.includes('#__PURE__')\n && warning.message.includes('terser')) {\n return;\n }\n if (warning.code === 'CIRCULAR_DEPENDENCY'\n && warning.message.includes('node_modules')) {\n return;\n }\n // Use default for everything else\n warn(warning);\n };\n}\n\nexport default getRollupOnWarn;\n"],"names":["getRollupExternal","importMetaUrl","options","_options$externals","Error","pkg","createRequire","require","peers","_toConsumableArray","Object","keys","peerDependencies","Array","isArray","length","peerPattern","RegExp","concat","join","additions","externals","id","test","_step","_iterator","_createForOfIteratorHelper","s","n","done","pattern","value","String","err","e","f","getRollupOutput","format","libraryName","_options$exports","_options$nodeEnv","_options$minify","_options$filenamePref","_options$outputDir","_options$sourcemap","filenameExt","footer","exports","nodeEnv","process","env","NODE_ENV","minify","filenamePrefix","camelCaseToDashCase","replace","toLowerCase","filenameBase","filename","outputDir","sourcemap","name","file","compact","getRollupPlugins","plugins","push","json","configAliasPlugin","_options$useAliasPlug","useAliasPlugin","_options$aliasPluginO","pluginOptions","aliasPluginOptions","entries","src","fileURLToPath","URL","debug","console","dir","depth","alias","configNodeResolvePlugin","_options$useNodeResol","useNodeResolvePlugin","_options$nodeResolveP","nodeResolvePluginOptions","nodeResolve","configCommonJsPlugin","_options$useCommonjsP","useCommonjsPlugin","_options$commonjsPlug","commonjsPluginOptions","include","commonjs","configBabelPlugin","_options$useBabelPlug","useBabelPlugin","_options$babelPluginO","babelPluginOptions","babelHelpers","exclude","presets","modules","babel","configTerserPlugin","_options$terserPlugin","terserPluginOptions","output","comments","keep_classnames","keep_fnames","terser","configAnalyzerPlugin","_options$useAnalyzerP","useAnalyzerPlugin","_options$analyzerPlug","analyzerPluginOptions","hideDeps","limit","summaryOnly","analyzer","configVisualizerPlugin","_options$useVisualize","useVisualizerPlugin","_options$visualizerPl","visualizerPluginOptions","gzipSize","brotliSize","visualizer","apply","rollupBuilder","_options$formats","_options$input","arguments","undefined","formats","result","input","clonedOptions","_objectSpread","config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