index.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. exports.ssrBuild = exports.build = exports.createBaseRollupPlugins = exports.onRollupWarning = void 0;
  7. const path_1 = __importDefault(require("path"));
  8. const fs_extra_1 = __importDefault(require("fs-extra"));
  9. const chalk_1 = __importDefault(require("chalk"));
  10. const p_map_series_1 = __importDefault(require("p-map-series"));
  11. const json_1 = require("klona/json");
  12. const utils_1 = require("../utils");
  13. const resolver_1 = require("../resolver");
  14. const buildPluginResolve_1 = require("./buildPluginResolve");
  15. const buildPluginHtml_1 = require("./buildPluginHtml");
  16. const buildPluginCss_1 = require("./buildPluginCss");
  17. const buildPluginAsset_1 = require("./buildPluginAsset");
  18. const buildPluginEsbuild_1 = require("./buildPluginEsbuild");
  19. const buildPluginReplace_1 = require("./buildPluginReplace");
  20. const esbuildService_1 = require("../esbuildService");
  21. const config_1 = require("../config");
  22. const transform_1 = require("../transform");
  23. const hash_sum_1 = __importDefault(require("hash-sum"));
  24. const cssUtils_1 = require("../utils/cssUtils");
  25. const buildPluginWasm_1 = require("./buildPluginWasm");
  26. const buildPluginManifest_1 = require("./buildPluginManifest");
  27. const writeColors = {
  28. [0 /* JS */]: chalk_1.default.cyan,
  29. [1 /* CSS */]: chalk_1.default.magenta,
  30. [2 /* ASSET */]: chalk_1.default.green,
  31. [3 /* HTML */]: chalk_1.default.blue,
  32. [4 /* SOURCE_MAP */]: chalk_1.default.gray
  33. };
  34. const warningIgnoreList = [`CIRCULAR_DEPENDENCY`, `THIS_IS_UNDEFINED`];
  35. const dynamicImportWarningIgnoreList = [
  36. `Unsupported expression`,
  37. `statically analyzed`
  38. ];
  39. const isBuiltin = require('isbuiltin');
  40. function onRollupWarning(spinner, options) {
  41. return (warning, warn) => {
  42. if (warning.code === 'UNRESOLVED_IMPORT') {
  43. let message;
  44. const id = warning.source;
  45. const importer = warning.importer;
  46. if (isBuiltin(id)) {
  47. let importingDep;
  48. if (importer) {
  49. const pkg = JSON.parse(utils_1.lookupFile(importer, ['package.json']) || `{}`);
  50. if (pkg.name) {
  51. importingDep = pkg.name;
  52. }
  53. }
  54. const allowList = options.allowNodeBuiltins;
  55. if (importingDep && allowList && allowList.includes(importingDep)) {
  56. return;
  57. }
  58. const dep = importingDep
  59. ? `Dependency ${chalk_1.default.yellow(importingDep)}`
  60. : `A dependency`;
  61. message =
  62. `${dep} is attempting to import Node built-in module ${chalk_1.default.yellow(id)}.\n` +
  63. `This will not work in a browser environment.\n` +
  64. `Imported by: ${chalk_1.default.gray(importer)}`;
  65. }
  66. else {
  67. message =
  68. `[vite]: Rollup failed to resolve import "${warning.source}" from "${warning.importer}".\n` +
  69. `This is most likely unintended because it can break your application at runtime.\n` +
  70. `If you do want to externalize this module explicitly add it to\n` +
  71. `\`rollupInputOptions.external\``;
  72. }
  73. if (spinner) {
  74. spinner.stop();
  75. }
  76. throw new Error(message);
  77. }
  78. if (warning.plugin === 'rollup-plugin-dynamic-import-variables' &&
  79. dynamicImportWarningIgnoreList.some((msg) => warning.message.includes(msg))) {
  80. return;
  81. }
  82. if (!warningIgnoreList.includes(warning.code)) {
  83. // ora would swallow the console.warn if we let it keep running
  84. // https://github.com/sindresorhus/ora/issues/90
  85. if (spinner) {
  86. spinner.stop();
  87. }
  88. warn(warning);
  89. if (spinner) {
  90. spinner.start();
  91. }
  92. }
  93. };
  94. }
  95. exports.onRollupWarning = onRollupWarning;
  96. /**
  97. * Creates non-application specific plugins that are shared between the main
  98. * app and the dependencies. This is used by the `optimize` command to
  99. * pre-bundle dependencies.
  100. */
  101. async function createBaseRollupPlugins(root, resolver, options) {
  102. const { transforms = [], vueCustomBlockTransforms = {}, enableEsbuild = true, enableRollupPluginVue = true } = options;
  103. const { nodeResolve } = require('@rollup/plugin-node-resolve');
  104. const dynamicImport = require('rollup-plugin-dynamic-import-variables');
  105. return [
  106. // vite:resolve
  107. buildPluginResolve_1.createBuildResolvePlugin(root, resolver),
  108. // vite:esbuild
  109. enableEsbuild ? await buildPluginEsbuild_1.createEsbuildPlugin(options.jsx) : null,
  110. // vue
  111. enableRollupPluginVue ? await createVuePlugin(root, options) : null,
  112. require('@rollup/plugin-json')({
  113. preferConst: true,
  114. indent: ' ',
  115. compact: false,
  116. namedExports: true
  117. }),
  118. // user transforms
  119. ...(transforms.length || Object.keys(vueCustomBlockTransforms).length
  120. ? [transform_1.createBuildJsTransformPlugin(transforms, vueCustomBlockTransforms)]
  121. : []),
  122. nodeResolve({
  123. rootDir: root,
  124. extensions: resolver_1.supportedExts,
  125. preferBuiltins: false,
  126. dedupe: options.rollupDedupe || [],
  127. mainFields: resolver_1.mainFields
  128. }),
  129. require('@rollup/plugin-commonjs')({
  130. extensions: ['.js', '.cjs']
  131. }),
  132. dynamicImport({
  133. warnOnError: true,
  134. include: [/\.js$/],
  135. exclude: [/node_modules/]
  136. })
  137. ].filter(Boolean);
  138. }
  139. exports.createBaseRollupPlugins = createBaseRollupPlugins;
  140. async function createVuePlugin(root, { vueCustomBlockTransforms = {}, rollupPluginVueOptions, cssPreprocessOptions, cssModuleOptions, vueCompilerOptions, vueTransformAssetUrls = {}, vueTemplatePreprocessOptions = {} }) {
  141. const { options: postcssOptions, plugins: postcssPlugins } = await cssUtils_1.resolvePostcssOptions(root, true);
  142. if (typeof vueTransformAssetUrls === 'object') {
  143. vueTransformAssetUrls = {
  144. includeAbsolute: true,
  145. ...vueTransformAssetUrls
  146. };
  147. }
  148. return require('rollup-plugin-vue')({
  149. ...rollupPluginVueOptions,
  150. templatePreprocessOptions: {
  151. ...vueTemplatePreprocessOptions,
  152. pug: {
  153. doctype: 'html',
  154. ...(vueTemplatePreprocessOptions && vueTemplatePreprocessOptions.pug)
  155. }
  156. },
  157. transformAssetUrls: vueTransformAssetUrls,
  158. postcssOptions,
  159. postcssPlugins,
  160. preprocessStyles: true,
  161. preprocessOptions: cssPreprocessOptions,
  162. preprocessCustomRequire: (id) => require(utils_1.resolveFrom(root, id)),
  163. compilerOptions: vueCompilerOptions,
  164. cssModulesOptions: {
  165. localsConvention: 'camelCase',
  166. generateScopedName: (local, filename) => `${local}_${hash_sum_1.default(filename)}`,
  167. ...cssModuleOptions,
  168. ...(rollupPluginVueOptions && rollupPluginVueOptions.cssModulesOptions)
  169. },
  170. customBlocks: Object.keys(vueCustomBlockTransforms)
  171. });
  172. }
  173. /**
  174. * Clone the given config object and fill it with default values.
  175. */
  176. function prepareConfig(config) {
  177. const { alias = {}, assetsDir = '_assets', assetsInclude = utils_1.isStaticAsset, assetsInlineLimit = 4096, base = '/', cssCodeSplit = true, cssModuleOptions = {}, cssPreprocessOptions = {}, define = {}, emitAssets = true, emitIndex = true, enableEsbuild = true, enableRollupPluginVue = true, entry = 'index.html', env = {}, esbuildTarget = 'es2020', indexHtmlTransforms = [], jsx = 'vue', minify = true, mode = 'production', optimizeDeps = {}, outDir = 'dist', resolvers = [], rollupDedupe = [], rollupInputOptions = {}, rollupOutputOptions = {}, rollupPluginVueOptions = {}, root = process.cwd(), shouldPreload = null, silent = false, sourcemap = false, terserOptions = {}, transforms = [], vueCompilerOptions = {}, vueCustomBlockTransforms = {}, vueTransformAssetUrls = {}, vueTemplatePreprocessOptions = {}, write = true } = json_1.klona(config);
  178. return {
  179. ...config,
  180. alias,
  181. assetsDir,
  182. assetsInclude,
  183. assetsInlineLimit,
  184. base,
  185. cssCodeSplit,
  186. cssModuleOptions,
  187. cssPreprocessOptions,
  188. define,
  189. emitAssets,
  190. emitIndex,
  191. enableEsbuild,
  192. enableRollupPluginVue,
  193. entry,
  194. env,
  195. esbuildTarget,
  196. indexHtmlTransforms,
  197. jsx,
  198. minify,
  199. mode,
  200. optimizeDeps,
  201. outDir,
  202. resolvers,
  203. rollupDedupe,
  204. rollupInputOptions,
  205. rollupOutputOptions,
  206. rollupPluginVueOptions,
  207. root,
  208. shouldPreload,
  209. silent,
  210. sourcemap,
  211. terserOptions,
  212. transforms,
  213. vueCompilerOptions,
  214. vueCustomBlockTransforms,
  215. vueTransformAssetUrls,
  216. vueTemplatePreprocessOptions,
  217. write
  218. };
  219. }
  220. /**
  221. * Bundles the app for production.
  222. * Returns a Promise containing the build result.
  223. */
  224. async function build(options) {
  225. const builds = [];
  226. const config = prepareConfig(options);
  227. const postBuildHooks = utils_1.toArray(config.configureBuild)
  228. .map((configureBuild) => configureBuild(config, builds))
  229. .filter(Boolean);
  230. const { root, assetsDir, assetsInlineLimit, emitAssets, minify, silent, sourcemap, shouldPreload, env, mode: configMode, define: userDefineReplacements, write } = config;
  231. const isTest = process.env.NODE_ENV === 'test';
  232. const resolvedMode = process.env.VITE_ENV || configMode;
  233. const start = Date.now();
  234. let spinner;
  235. const msg = `Building ${configMode} bundle...`;
  236. if (!silent) {
  237. if (process.env.DEBUG || isTest) {
  238. console.log(msg);
  239. }
  240. else {
  241. spinner = require('ora')(msg + '\n').start();
  242. }
  243. }
  244. const outDir = path_1.default.resolve(root, config.outDir);
  245. const indexPath = path_1.default.resolve(root, 'index.html');
  246. const publicDir = path_1.default.join(root, 'public');
  247. const publicBasePath = config.base.replace(/([^/])$/, '$1/'); // ensure ending slash
  248. const resolvedAssetsPath = path_1.default.join(outDir, assetsDir);
  249. const resolver = resolver_1.createResolver(root, config.resolvers, config.alias, config.assetsInclude);
  250. const { htmlPlugin, renderIndex } = await buildPluginHtml_1.createBuildHtmlPlugin(root, indexPath, publicBasePath, assetsDir, assetsInlineLimit, resolver, shouldPreload, options);
  251. const basePlugins = await createBaseRollupPlugins(root, resolver, config);
  252. // https://github.com/darionco/rollup-plugin-web-worker-loader
  253. // configured to support `import Worker from './my-worker?worker'`
  254. // this plugin relies on resolveId and must be placed before node-resolve
  255. // since the latter somehow swallows ids with query strings since 8.x
  256. basePlugins.splice(basePlugins.findIndex((p) => p.name.includes('node-resolve')), 0, require('rollup-plugin-web-worker-loader')({
  257. targetPlatform: 'browser',
  258. pattern: /(.+)\?worker$/,
  259. extensions: resolver_1.supportedExts,
  260. sourcemap: false // it's inlined so it bloats the bundle
  261. }));
  262. // user env variables loaded from .env files.
  263. // only those prefixed with VITE_ are exposed.
  264. const userClientEnv = {};
  265. const userEnvReplacements = {};
  266. Object.keys(env).forEach((key) => {
  267. if (key.startsWith(`VITE_`)) {
  268. userEnvReplacements[`import.meta.env.${key}`] = JSON.stringify(env[key]);
  269. userClientEnv[key] = env[key];
  270. }
  271. });
  272. const builtInClientEnv = {
  273. BASE_URL: publicBasePath,
  274. MODE: configMode,
  275. DEV: resolvedMode !== 'production',
  276. PROD: resolvedMode === 'production'
  277. };
  278. const builtInEnvReplacements = {};
  279. Object.keys(builtInClientEnv).forEach((key) => {
  280. builtInEnvReplacements[`import.meta.env.${key}`] = JSON.stringify(builtInClientEnv[key]);
  281. });
  282. Object.keys(userDefineReplacements).forEach((key) => {
  283. userDefineReplacements[key] = JSON.stringify(userDefineReplacements[key]);
  284. });
  285. const { pluginsPreBuild = [], plugins = [], pluginsPostBuild = [], pluginsOptimizer, ...rollupInputOptions } = config.rollupInputOptions;
  286. builds.unshift({
  287. input: config.entry,
  288. preserveEntrySignatures: false,
  289. treeshake: { moduleSideEffects: 'no-external' },
  290. ...rollupInputOptions,
  291. output: config.rollupOutputOptions,
  292. plugins: [
  293. ...plugins,
  294. ...pluginsPreBuild,
  295. ...basePlugins,
  296. // vite:html
  297. htmlPlugin,
  298. // we use a custom replacement plugin because @rollup/plugin-replace
  299. // performs replacements twice, once at transform and once at renderChunk
  300. // - which makes it impossible to exclude Vue templates from it since
  301. // Vue templates are compiled into js and included in chunks.
  302. buildPluginReplace_1.createReplacePlugin((id) => !/\?vue&type=template/.test(id) &&
  303. // also exclude css and static assets for performance
  304. !cssUtils_1.isCSSRequest(id) &&
  305. !resolver.isAssetRequest(id), {
  306. ...config_1.defaultDefines,
  307. ...userDefineReplacements,
  308. ...userEnvReplacements,
  309. ...builtInEnvReplacements,
  310. 'import.meta.env.': `({}).`,
  311. 'import.meta.env': JSON.stringify({
  312. ...userClientEnv,
  313. ...builtInClientEnv
  314. }),
  315. 'process.env.NODE_ENV': JSON.stringify(resolvedMode),
  316. 'process.env.': `({}).`,
  317. 'process.env': JSON.stringify({ NODE_ENV: resolvedMode }),
  318. 'import.meta.hot': `false`
  319. }, !!sourcemap),
  320. // vite:css
  321. buildPluginCss_1.createBuildCssPlugin({
  322. root,
  323. publicBase: publicBasePath,
  324. assetsDir,
  325. minify,
  326. inlineLimit: assetsInlineLimit,
  327. cssCodeSplit: config.cssCodeSplit,
  328. preprocessOptions: config.cssPreprocessOptions,
  329. modulesOptions: config.cssModuleOptions
  330. }),
  331. // vite:wasm
  332. buildPluginWasm_1.createBuildWasmPlugin(root, publicBasePath, assetsDir, assetsInlineLimit),
  333. // vite:asset
  334. buildPluginAsset_1.createBuildAssetPlugin(root, resolver, publicBasePath, assetsDir, assetsInlineLimit),
  335. config.enableEsbuild &&
  336. buildPluginEsbuild_1.createEsbuildRenderChunkPlugin(config.esbuildTarget, minify === 'esbuild'),
  337. // minify with terser
  338. // this is the default which has better compression, but slow
  339. // the user can opt-in to use esbuild which is much faster but results
  340. // in ~8-10% larger file size.
  341. minify && minify !== 'esbuild'
  342. ? require('rollup-plugin-terser').terser(config.terserOptions)
  343. : undefined,
  344. // #728 user plugins should apply after `@rollup/plugin-commonjs`
  345. // #471#issuecomment-683318951 user plugin after internal plugin
  346. ...pluginsPostBuild,
  347. // vite:manifest
  348. config.emitManifest ? buildPluginManifest_1.createBuildManifestPlugin() : undefined
  349. ].filter(Boolean)
  350. });
  351. // lazy require rollup so that we don't load it when only using the dev server
  352. // importing it just for the types
  353. const rollup = require('rollup').rollup;
  354. // multiple builds are processed sequentially, in case a build
  355. // depends on the output of a preceding build.
  356. const results = await p_map_series_1.default(builds, async (build, i) => {
  357. const { output: outputOptions, onResult, ...inputOptions } = build;
  358. let result;
  359. let indexHtml;
  360. let indexHtmlPath = getIndexHtmlOutputPath(build);
  361. const emitIndex = config.emitIndex && indexHtmlPath !== null;
  362. try {
  363. const bundle = await rollup({
  364. onwarn: onRollupWarning(spinner, config.optimizeDeps),
  365. ...inputOptions,
  366. plugins: [
  367. ...(inputOptions.plugins || []).filter(
  368. // remove vite:emit in case this build copied another build's plugins
  369. (plugin) => plugin.name !== 'vite:emit'),
  370. // vite:emit
  371. createEmitPlugin(emitAssets, async (assets) => {
  372. indexHtml = emitIndex ? await renderIndex(assets) : '';
  373. result = { build, assets, html: indexHtml };
  374. if (onResult) {
  375. await onResult(result);
  376. }
  377. // run post-build hooks sequentially
  378. await postBuildHooks.reduce((queue, hook) => queue.then(() => hook(result)), Promise.resolve());
  379. if (write) {
  380. if (i === 0) {
  381. await fs_extra_1.default.emptyDir(outDir);
  382. }
  383. if (emitIndex) {
  384. indexHtmlPath = path_1.default.join(outDir, indexHtmlPath);
  385. await fs_extra_1.default.writeFile(indexHtmlPath, indexHtml);
  386. }
  387. }
  388. })
  389. ]
  390. });
  391. await bundle[write ? 'write' : 'generate']({
  392. dir: resolvedAssetsPath,
  393. format: 'es',
  394. sourcemap,
  395. entryFileNames: `[name].[hash].js`,
  396. chunkFileNames: `[name].[hash].js`,
  397. assetFileNames: `[name].[hash].[ext]`,
  398. ...outputOptions
  399. });
  400. }
  401. finally {
  402. spinner && spinner.stop();
  403. }
  404. if (write && !silent) {
  405. if (emitIndex) {
  406. printFileInfo(indexHtmlPath, indexHtml, 3 /* HTML */);
  407. }
  408. for (const chunk of result.assets) {
  409. if (chunk.type === 'chunk') {
  410. const filePath = path_1.default.join(resolvedAssetsPath, chunk.fileName);
  411. printFileInfo(filePath, chunk.code, 0 /* JS */);
  412. if (chunk.map) {
  413. printFileInfo(filePath + '.map', chunk.map.toString(), 4 /* SOURCE_MAP */);
  414. }
  415. }
  416. else if (emitAssets && chunk.source)
  417. printFileInfo(path_1.default.join(resolvedAssetsPath, chunk.fileName), chunk.source, chunk.fileName.endsWith('.css') ? 1 /* CSS */ : 2 /* ASSET */);
  418. }
  419. }
  420. spinner && spinner.start();
  421. return result;
  422. });
  423. // copy over /public if it exists
  424. if (write && emitAssets && fs_extra_1.default.existsSync(publicDir)) {
  425. for (const file of await fs_extra_1.default.readdir(publicDir)) {
  426. await fs_extra_1.default.copy(path_1.default.join(publicDir, file), path_1.default.resolve(outDir, file));
  427. }
  428. }
  429. spinner && spinner.stop();
  430. if (!silent) {
  431. console.log(`Build completed in ${((Date.now() - start) / 1000).toFixed(2)}s.\n`);
  432. }
  433. // stop the esbuild service after each build
  434. await esbuildService_1.stopService();
  435. return results;
  436. }
  437. exports.build = build;
  438. /**
  439. * Bundles the app in SSR mode.
  440. * - All Vue dependencies are automatically externalized
  441. * - Imports to dependencies are compiled into require() calls
  442. * - Templates are compiled with SSR specific optimizations.
  443. */
  444. async function ssrBuild(options) {
  445. const { rollupInputOptions, rollupOutputOptions, rollupPluginVueOptions } = options;
  446. return build({
  447. outDir: 'dist-ssr',
  448. ...options,
  449. rollupPluginVueOptions: {
  450. ...rollupPluginVueOptions,
  451. target: 'node'
  452. },
  453. rollupInputOptions: {
  454. ...rollupInputOptions,
  455. external: resolveExternal(rollupInputOptions && rollupInputOptions.external)
  456. },
  457. rollupOutputOptions: {
  458. ...rollupOutputOptions,
  459. format: 'cjs',
  460. exports: 'named',
  461. entryFileNames: '[name].js',
  462. // 764 add `Symbol.toStringTag` when build es module into cjs chunk
  463. namespaceToStringTag: true
  464. },
  465. emitIndex: false,
  466. emitAssets: false,
  467. cssCodeSplit: false,
  468. minify: false
  469. });
  470. }
  471. exports.ssrBuild = ssrBuild;
  472. function createEmitPlugin(emitAssets, emit) {
  473. return {
  474. name: 'vite:emit',
  475. async generateBundle(_, output) {
  476. // assume the first asset in `output` is an entry chunk
  477. const assets = Object.values(output);
  478. // process the output before writing
  479. await emit(assets);
  480. // write any assets injected by post-build hooks
  481. for (const asset of assets) {
  482. output[asset.fileName] = asset;
  483. }
  484. // remove assets from bundle if emitAssets is false
  485. if (!emitAssets) {
  486. for (const name in output) {
  487. if (output[name].type === 'asset') {
  488. delete output[name];
  489. }
  490. }
  491. }
  492. }
  493. };
  494. }
  495. /**
  496. * Resolve the output path of `index.html` for the given build (relative to
  497. * `outDir` in Vite config).
  498. */
  499. function getIndexHtmlOutputPath(build) {
  500. const { input, output } = build;
  501. return input === 'index.html' ? output.file || input : null;
  502. }
  503. function resolveExternal(userExternal) {
  504. const required = ['vue', /^@vue\//];
  505. if (!userExternal) {
  506. return required;
  507. }
  508. if (Array.isArray(userExternal)) {
  509. return [...required, ...userExternal];
  510. }
  511. else if (typeof userExternal === 'function') {
  512. return (src, importer, isResolved) => {
  513. if (src === 'vue' || /^@vue\//.test(src)) {
  514. return true;
  515. }
  516. return userExternal(src, importer, isResolved);
  517. };
  518. }
  519. else {
  520. return [...required, userExternal];
  521. }
  522. }
  523. function printFileInfo(filePath, content, type) {
  524. const needCompression = type === 0 /* JS */ || type === 1 /* CSS */ || type === 3 /* HTML */;
  525. const compressed = needCompression
  526. ? `, brotli: ${(require('brotli-size').sync(content) / 1024).toFixed(2)}kb`
  527. : ``;
  528. console.log(`${chalk_1.default.gray(`[write]`)} ${writeColors[type](path_1.default.relative(process.cwd(), filePath))} ${(content.length / 1024).toFixed(2)}kb${compressed}`);
  529. }
  530. //# sourceMappingURL=index.js.map