tsdown 0.15.1 → 0.15.3

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.
@@ -1,4 +1,4 @@
1
- import { UserConfig, UserConfigFn } from "./types-CttfsBjJ.mjs";
1
+ import { UserConfig, UserConfigFn } from "./types-CDDBvUh8.mjs";
2
2
 
3
3
  //#region src/config.d.ts
4
4
 
package/dist/config.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { UserConfig, UserConfigFn } from "./types-CttfsBjJ.mjs";
2
- import { defineConfig } from "./config-Cb8AaSYW.mjs";
1
+ import { UserConfig, UserConfigFn } from "./types-CDDBvUh8.mjs";
2
+ import { defineConfig } from "./config-Bm-9Qi9v.mjs";
3
3
  export { UserConfig, UserConfigFn, defineConfig };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, Logger, ModuleTypes, NormalizedFormat, NormalizedUserConfig, Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigFn, Workspace, globalLogger } from "./types-CttfsBjJ.mjs";
2
- import { defineConfig } from "./config-Cb8AaSYW.mjs";
1
+ import { AttwOptions, BuildContext, ChunkAddon, ChunkAddonFunction, ChunkAddonObject, CopyEntry, CopyOptions, CopyOptionsFn, DtsOptions, ExportsOptions, Format, Logger, ModuleTypes, NormalizedFormat, NormalizedUserConfig, Options, OutExtensionContext, OutExtensionFactory, OutExtensionObject, PackageType, PublintOptions, ReportOptions, ResolvedOptions, RolldownContext, Sourcemap, TsdownChunks, TsdownHooks, UnusedOptions, UserConfig, UserConfigFn, Workspace, globalLogger } from "./types-CDDBvUh8.mjs";
2
+ import { defineConfig } from "./config-Bm-9Qi9v.mjs";
3
3
 
4
4
  //#region src/index.d.ts
5
5
 
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineConfig } from "./config-CCGWF4al.mjs";
2
- import { build, buildSingle, shimFile } from "./src-Cv09-2ZP.mjs";
2
+ import { build, buildSingle, shimFile } from "./src-AiuiQJQr.mjs";
3
3
  import { globalLogger } from "./logger-C09npKHT.mjs";
4
4
 
5
5
  export { build, buildSingle, defineConfig, globalLogger, shimFile };
@@ -1,5 +1,5 @@
1
1
  import { globalLogger } from "./logger-C09npKHT.mjs";
2
- import { version } from "./package-CGTDSgsc.mjs";
2
+ import { version } from "./package-x7iVusai.mjs";
3
3
  import process from "node:process";
4
4
  import { bold, green, underline } from "ansis";
5
5
  import { readFile, unlink, writeFile } from "node:fs/promises";
@@ -0,0 +1,5 @@
1
+ //#region package.json
2
+ var version = "0.15.3";
3
+
4
+ //#endregion
5
+ export { version };
@@ -1,4 +1,4 @@
1
- import { Logger, ReportPlugin, ResolvedOptions } from "./types-CttfsBjJ.mjs";
1
+ import { Logger, ReportPlugin, ResolvedOptions } from "./types-CDDBvUh8.mjs";
2
2
  import { Plugin } from "rolldown";
3
3
  import { PackageJson } from "pkg-types";
4
4
 
package/dist/plugins.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./config-CCGWF4al.mjs";
2
- import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./src-Cv09-2ZP.mjs";
2
+ import { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin } from "./src-AiuiQJQr.mjs";
3
3
  import "./logger-C09npKHT.mjs";
4
4
 
5
5
  export { ExternalPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin };
package/dist/run.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  import { globalLogger, resolveComma, toArray } from "./logger-C09npKHT.mjs";
3
- import { version } from "./package-CGTDSgsc.mjs";
3
+ import { version } from "./package-x7iVusai.mjs";
4
4
  import module from "node:module";
5
5
  import process from "node:process";
6
6
  import { dim } from "ansis";
7
7
  import { VERSION } from "rolldown";
8
- import Debug from "debug";
8
+ import debug from "debug";
9
9
  import { cac } from "cac";
10
10
 
11
11
  //#region src/cli.ts
@@ -22,7 +22,7 @@ cli.command("[...files]", "Bundle files", {
22
22
  await build$1(flags);
23
23
  });
24
24
  cli.command("migrate", "Migrate from tsup to tsdown").option("-c, --cwd <dir>", "Working directory").option("-d, --dry-run", "Dry run").action(async (args) => {
25
- const { migrate } = await import("./migrate-CliKn3g9.mjs");
25
+ const { migrate } = await import("./migrate-Buw8lGN7.mjs");
26
26
  await migrate(args);
27
27
  });
28
28
  async function runCLI() {
@@ -31,10 +31,10 @@ async function runCLI() {
31
31
  let namespace;
32
32
  if (cli.options.debug === true) namespace = "tsdown:*";
33
33
  else namespace = resolveComma(toArray(cli.options.debug)).map((v) => `tsdown:${v}`).join(",");
34
- const enabled = Debug.disable();
34
+ const enabled = debug.disable();
35
35
  if (enabled) namespace += `,${enabled}`;
36
- Debug.enable(namespace);
37
- Debug("tsdown:debug")("Debugging enabled", namespace);
36
+ debug.enable(namespace);
37
+ debug("tsdown:debug")("Debugging enabled", namespace);
38
38
  }
39
39
  try {
40
40
  await cli.runMatchedCommand();
@@ -11,7 +11,7 @@ import child_process from "node:child_process";
11
11
  import { access, chmod, cp, mkdtemp, readFile, rm, stat, writeFile } from "node:fs/promises";
12
12
  import { tmpdir } from "node:os";
13
13
  import { promisify } from "node:util";
14
- import Debug from "debug";
14
+ import debug from "debug";
15
15
  import coerce from "semver/functions/coerce.js";
16
16
  import satisfies from "semver/functions/satisfies.js";
17
17
  import { glob } from "tinyglobby";
@@ -67,7 +67,7 @@ function lowestCommonAncestor(...filepaths) {
67
67
 
68
68
  //#endregion
69
69
  //#region src/features/attw.ts
70
- const debug$7 = Debug("tsdown:attw");
70
+ const debug$8 = debug("tsdown:attw");
71
71
  const exec$1 = promisify(child_process.exec);
72
72
  /**
73
73
  * ATTW profiles.
@@ -113,7 +113,7 @@ async function attw(options) {
113
113
  }
114
114
  const { profile = "strict", level = "warn",...attwOptions } = options.attw === true ? {} : options.attw;
115
115
  const t = performance.now();
116
- debug$7("Running attw check");
116
+ debug$8("Running attw check");
117
117
  const tempDir = await mkdtemp(path.join(tmpdir(), "tsdown-attw-"));
118
118
  let attwCore;
119
119
  try {
@@ -133,7 +133,7 @@ async function attw(options) {
133
133
  const tarball = await readFile(tarballPath);
134
134
  const pkg = attwCore.createPackageFromTarballData(tarball);
135
135
  const checkResult = await attwCore.checkPackage(pkg, attwOptions);
136
- if (checkResult.types !== false && checkResult.problems) {
136
+ if (checkResult.types !== false && checkResult.problems.length) {
137
137
  const problems = checkResult.problems.filter((problem) => {
138
138
  if ("resolutionKind" in problem) return !profiles[profile]?.includes(problem.resolutionKind);
139
139
  return true;
@@ -146,7 +146,7 @@ async function attw(options) {
146
146
  } else options.logger.success(`No Are the types wrong problems found`, dim`(${Math.round(performance.now() - t)}ms)`);
147
147
  } catch (error) {
148
148
  options.logger.error("ATTW check failed:", error);
149
- debug$7("Found errors, setting exit code to 1");
149
+ debug$8("Found errors, setting exit code to 1");
150
150
  process.exitCode = 1;
151
151
  } finally {
152
152
  await fsRemove(tempDir);
@@ -170,7 +170,7 @@ function warnLegacyCJS(config) {
170
170
 
171
171
  //#endregion
172
172
  //#region src/features/clean.ts
173
- const debug$6 = Debug("tsdown:clean");
173
+ const debug$7 = debug("tsdown:clean");
174
174
  const RE_LAST_SLASH = /[/\\]$/;
175
175
  async function cleanOutDir(configs) {
176
176
  const removes = /* @__PURE__ */ new Set();
@@ -187,10 +187,10 @@ async function cleanOutDir(configs) {
187
187
  if (!removes.size) return;
188
188
  globalLogger.info(`Cleaning ${removes.size} files`);
189
189
  await Promise.all([...removes].map(async (file) => {
190
- debug$6("Removing", file);
190
+ debug$7("Removing", file);
191
191
  await fsRemove(file);
192
192
  }));
193
- debug$6("Removed %d files", removes.size);
193
+ debug$7("Removed %d files", removes.size);
194
194
  }
195
195
  function resolveClean(clean, outDir, cwd) {
196
196
  if (clean === true) clean = [slash(outDir)];
@@ -348,7 +348,7 @@ async function createHooks$1(options) {
348
348
 
349
349
  //#endregion
350
350
  //#region src/features/publint.ts
351
- const debug$5 = Debug("tsdown:publint");
351
+ const debug$6 = debug("tsdown:publint");
352
352
  async function publint(options) {
353
353
  if (!options.publint) return;
354
354
  if (!options.pkg) {
@@ -356,11 +356,11 @@ async function publint(options) {
356
356
  return;
357
357
  }
358
358
  const t = performance.now();
359
- debug$5("Running publint");
359
+ debug$6("Running publint");
360
360
  const { publint: publint$1 } = await import("publint");
361
361
  const { formatMessage } = await import("publint/utils");
362
362
  const { messages } = await publint$1(options.publint === true ? {} : options.publint);
363
- debug$5("Found %d issues", messages.length);
363
+ debug$6("Found %d issues", messages.length);
364
364
  if (!messages.length) options.logger.success(`No publint issues found`, dim`(${Math.round(performance.now() - t)}ms)`);
365
365
  let hasError = false;
366
366
  for (const message of messages) {
@@ -374,7 +374,7 @@ async function publint(options) {
374
374
  options.logger[logType](formattedMessage);
375
375
  }
376
376
  if (hasError) {
377
- debug$5("Found errors, setting exit code to 1");
377
+ debug$6("Found errors, setting exit code to 1");
378
378
  process.exitCode = 1;
379
379
  }
380
380
  }
@@ -429,31 +429,6 @@ function resolvePackageTarget(pkg) {
429
429
  if (nodeMinVersion.version === "0.0.0") return;
430
430
  return `node${nodeMinVersion.version}`;
431
431
  }
432
- let warned = false;
433
- function RuntimeHelperCheckPlugin(logger, targets) {
434
- return {
435
- name: "tsdown:runtime-helper-check",
436
- resolveId: {
437
- filter: { id: /^@oxc-project\/runtime/ },
438
- async handler(id, ...args) {
439
- const EXTERNAL = {
440
- id,
441
- external: true
442
- };
443
- if (warned) return EXTERNAL;
444
- const resolved = await this.resolve(id, ...args);
445
- if (!resolved) {
446
- if (!warned) {
447
- warned = true;
448
- logger.warn(`The target environment (${targets.join(", ")}) requires runtime helpers from ${blue`@oxc-project/runtime`}. Please install it to ensure all necessary polyfills are included.\nFor more information, visit: https://tsdown.dev/options/target#runtime-helpers`);
449
- }
450
- return EXTERNAL;
451
- }
452
- return resolved;
453
- }
454
- }
455
- };
456
- }
457
432
 
458
433
  //#endregion
459
434
  //#region src/features/tsconfig.ts
@@ -485,11 +460,11 @@ async function resolveTsconfig(logger, tsconfig, cwd, name) {
485
460
 
486
461
  //#endregion
487
462
  //#region src/utils/package.ts
488
- const debug$4 = Debug("tsdown:package");
463
+ const debug$5 = debug("tsdown:package");
489
464
  async function readPackageJson(dir) {
490
465
  const packageJsonPath = up$1({ cwd: dir });
491
466
  if (!packageJsonPath) return;
492
- debug$4("Reading package.json:", packageJsonPath);
467
+ debug$5("Reading package.json:", packageJsonPath);
493
468
  const contents = await readFile(packageJsonPath, "utf8");
494
469
  return {
495
470
  ...JSON.parse(contents),
@@ -615,7 +590,7 @@ async function nativeImport(id) {
615
590
 
616
591
  //#endregion
617
592
  //#region src/options/index.ts
618
- const debug$3 = Debug("tsdown:options");
593
+ const debug$4 = debug("tsdown:options");
619
594
  const DEFAULT_EXCLUDE_WORKSPACE = [
620
595
  "**/node_modules/**",
621
596
  "**/dist/**",
@@ -623,20 +598,20 @@ const DEFAULT_EXCLUDE_WORKSPACE = [
623
598
  "**/t?(e)mp/**"
624
599
  ];
625
600
  async function resolveOptions(options) {
626
- debug$3("options %O", options);
601
+ debug$4("options %O", options);
627
602
  const { configs: rootConfigs, file } = await loadConfigFile(options);
628
603
  const files = [];
629
604
  if (file) {
630
605
  files.push(file);
631
- debug$3("loaded root config file %s", file);
632
- debug$3("root configs %O", rootConfigs);
633
- } else debug$3("no root config file found");
606
+ debug$4("loaded root config file %s", file);
607
+ debug$4("root configs %O", rootConfigs);
608
+ } else debug$4("no root config file found");
634
609
  const configs = (await Promise.all(rootConfigs.map(async (rootConfig) => {
635
610
  const { configs: workspaceConfigs, files: workspaceFiles } = await resolveWorkspace(rootConfig, options);
636
611
  if (workspaceFiles) files.push(...workspaceFiles);
637
612
  return Promise.all(workspaceConfigs.filter((config) => !config.workspace || config.entry).map((config) => resolveConfig(config)));
638
613
  }))).flat();
639
- debug$3("resolved configs %O", configs);
614
+ debug$4("resolved configs %O", configs);
640
615
  return {
641
616
  configs,
642
617
  files
@@ -679,16 +654,16 @@ async function resolveWorkspace(config, options) {
679
654
  const files = [];
680
655
  return {
681
656
  configs: (await Promise.all(packages.map(async (cwd) => {
682
- debug$3("loading workspace config %s", cwd);
657
+ debug$4("loading workspace config %s", cwd);
683
658
  const { configs, file } = await loadConfigFile({
684
659
  ...options,
685
660
  config: workspaceConfig,
686
661
  cwd
687
662
  }, cwd);
688
663
  if (file) {
689
- debug$3("loaded workspace config file %s", file);
664
+ debug$4("loaded workspace config file %s", file);
690
665
  files.push(file);
691
- } else debug$3("no workspace config file found in %s", cwd);
666
+ } else debug$4("no workspace config file found in %s", cwd);
692
667
  return configs.map((config$1) => ({
693
668
  ...normalized,
694
669
  cwd,
@@ -699,7 +674,7 @@ async function resolveWorkspace(config, options) {
699
674
  };
700
675
  }
701
676
  async function resolveConfig(userConfig) {
702
- let { entry, format = ["es"], plugins = [], clean = true, silent = false, logLevel = silent ? "silent" : "info", failOnWarn = false, customLogger, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch = [], shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, attw: attw$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd(), name, workspace, external, noExternal, exports = false, bundle, unbundle = typeof bundle === "boolean" ? !bundle : false, removeNodeProtocol, nodeProtocol, cjsDefault = true } = userConfig;
677
+ let { entry, format = ["es"], plugins = [], clean = true, silent = false, logLevel = silent ? "silent" : "info", failOnWarn = false, customLogger, treeshake = true, platform = "node", outDir = "dist", sourcemap = false, dts, unused = false, watch = false, ignoreWatch = [], shims = false, skipNodeModulesBundle = false, publint: publint$1 = false, attw: attw$1 = false, fromVite, alias, tsconfig, report = true, target, env = {}, copy: copy$1, publicDir, hash, cwd = process.cwd(), name, workspace, external, noExternal, exports = false, bundle, unbundle = typeof bundle === "boolean" ? !bundle : false, removeNodeProtocol, nodeProtocol, cjsDefault = true, globImport = true } = userConfig;
703
678
  const logger = createLogger(logLevel, {
704
679
  customLogger,
705
680
  failOnWarn
@@ -725,10 +700,13 @@ async function resolveConfig(userConfig) {
725
700
  if (fromVite) {
726
701
  const viteUserConfig = await loadViteConfig(fromVite === true ? "vite" : fromVite, cwd);
727
702
  if (viteUserConfig) {
728
- if (Array.isArray(alias)) throw new TypeError("Unsupported resolve.alias in Vite config. Use object instead of array");
729
- if (viteUserConfig.plugins) plugins = [viteUserConfig.plugins, plugins];
730
703
  const viteAlias = viteUserConfig.resolve?.alias;
731
- if (viteAlias && !Array.isArray(viteAlias)) alias = viteAlias;
704
+ if (Array.isArray(viteAlias)) throw new TypeError("Unsupported resolve.alias in Vite config. Use object instead of array");
705
+ if (viteAlias) alias = {
706
+ ...alias,
707
+ ...viteAlias
708
+ };
709
+ if (viteUserConfig.plugins) plugins = [viteUserConfig.plugins, plugins];
732
710
  }
733
711
  }
734
712
  ignoreWatch = toArray(ignoreWatch).map((ignore) => {
@@ -770,7 +748,8 @@ async function resolveConfig(userConfig) {
770
748
  exports,
771
749
  unbundle,
772
750
  nodeProtocol,
773
- cjsDefault
751
+ cjsDefault,
752
+ globImport
774
753
  };
775
754
  }
776
755
  async function mergeUserOptions(defaults, user, args) {
@@ -783,7 +762,7 @@ async function mergeUserOptions(defaults, user, args) {
783
762
 
784
763
  //#endregion
785
764
  //#region src/features/external.ts
786
- const debug$2 = Debug("tsdown:external");
765
+ const debug$3 = debug("tsdown:external");
787
766
  function ExternalPlugin(options) {
788
767
  const deps = options.pkg && Array.from(getProductionDeps(options.pkg));
789
768
  return {
@@ -810,7 +789,7 @@ function ExternalPlugin(options) {
810
789
  }
811
790
  if (deps) shouldExternal ||= deps.some((dep) => id === dep || id.startsWith(`${dep}/`));
812
791
  if (shouldExternal) {
813
- debug$2("External dependency:", id);
792
+ debug$3("External dependency:", id);
814
793
  return {
815
794
  id,
816
795
  external: shouldExternal,
@@ -934,12 +913,12 @@ function resolveChunkFilename({ outExtensions, fixedExtension, pkg, hash }, inpu
934
913
  jsExtension = js;
935
914
  dtsExtension = dts;
936
915
  }
937
- jsExtension ||= `.${resolveJsOutputExtension(packageType, format, fixedExtension)}`;
916
+ jsExtension ??= `.${resolveJsOutputExtension(packageType, format, fixedExtension)}`;
938
917
  const suffix = format === "iife" || format === "umd" ? `.${format}` : "";
939
918
  return [createChunkFilename(`[name]${suffix}`, jsExtension, dtsExtension), createChunkFilename(`[name]${suffix}${hash ? "-[hash]" : ""}`, jsExtension, dtsExtension)];
940
919
  }
941
920
  function createChunkFilename(basename, jsExtension, dtsExtension) {
942
- if (!dtsExtension) return `${basename}${jsExtension}`;
921
+ if (dtsExtension === void 0) return `${basename}${jsExtension}`;
943
922
  return (chunk) => {
944
923
  return `${basename}${chunk.name.endsWith(".d") ? dtsExtension : jsExtension}`;
945
924
  };
@@ -971,7 +950,7 @@ function formatBytes(bytes) {
971
950
 
972
951
  //#endregion
973
952
  //#region src/features/report.ts
974
- const debug$1 = Debug("tsdown:report");
953
+ const debug$2 = debug("tsdown:report");
975
954
  const brotliCompressAsync = promisify(brotliCompress);
976
955
  const gzipAsync = promisify(gzip);
977
956
  function ReportPlugin(options, logger, cwd, cjsDts, name, isMultiFormat) {
@@ -1012,19 +991,19 @@ function ReportPlugin(options, logger, cwd, cjsDts, name, isMultiFormat) {
1012
991
  };
1013
992
  }
1014
993
  async function calcSize(options, chunk) {
1015
- debug$1(`Calculating size for`, chunk.fileName);
994
+ debug$2(`Calculating size for`, chunk.fileName);
1016
995
  const content = chunk.type === "chunk" ? chunk.code : chunk.source;
1017
996
  const raw = Buffer.byteLength(content, "utf8");
1018
- debug$1("[size]", chunk.fileName, raw);
997
+ debug$2("[size]", chunk.fileName, raw);
1019
998
  let gzip$1 = Infinity;
1020
999
  let brotli = Infinity;
1021
- if (raw > (options.maxCompressSize ?? 1e6)) debug$1(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
1000
+ if (raw > (options.maxCompressSize ?? 1e6)) debug$2(chunk.fileName, "file size exceeds limit, skip gzip/brotli");
1022
1001
  else {
1023
1002
  gzip$1 = (await gzipAsync(content)).length;
1024
- debug$1("[gzip]", chunk.fileName, gzip$1);
1003
+ debug$2("[gzip]", chunk.fileName, gzip$1);
1025
1004
  if (options.brotli) {
1026
1005
  brotli = (await brotliCompressAsync(content)).length;
1027
- debug$1("[brotli]", chunk.fileName, brotli);
1006
+ debug$2("[brotli]", chunk.fileName, brotli);
1028
1007
  }
1029
1008
  }
1030
1009
  return {
@@ -1071,7 +1050,7 @@ function getShimsInject(format, platform) {
1071
1050
 
1072
1051
  //#endregion
1073
1052
  //#region src/features/rolldown.ts
1074
- const debug = Debug("tsdown:rolldown");
1053
+ const debug$1 = debug("tsdown:rolldown");
1075
1054
  async function getBuildOptions(config, format, isMultiFormat, cjsDts = false) {
1076
1055
  const inputOptions = await resolveInputOptions(config, format, cjsDts, isMultiFormat);
1077
1056
  const outputOptions = await resolveOutputOptions(inputOptions, config, format, cjsDts);
@@ -1079,11 +1058,11 @@ async function getBuildOptions(config, format, isMultiFormat, cjsDts = false) {
1079
1058
  ...inputOptions,
1080
1059
  output: outputOptions
1081
1060
  };
1082
- debug("rolldown config with format \"%s\" %O", cjsDts ? "cjs dts" : format, rolldownConfig);
1061
+ debug$1("rolldown config with format \"%s\" %O", cjsDts ? "cjs dts" : format, rolldownConfig);
1083
1062
  return rolldownConfig;
1084
1063
  }
1085
1064
  async function resolveInputOptions(config, format, cjsDts, isMultiFormat) {
1086
- const { entry, external, plugins: userPlugins, platform, alias, treeshake, dts, unused, target, define, shims, tsconfig, cwd, report, env, nodeProtocol, loader, name, logger, cjsDefault, banner, footer } = config;
1065
+ const { entry, external, plugins: userPlugins, platform, alias, treeshake, dts, unused, target, define, shims, tsconfig, cwd, report, env, nodeProtocol, loader, name, logger, cjsDefault, banner, footer, globImport } = config;
1087
1066
  const plugins = [];
1088
1067
  if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
1089
1068
  if (config.pkg || config.skipNodeModulesBundle) plugins.push(ExternalPlugin(config));
@@ -1107,8 +1086,9 @@ async function resolveInputOptions(config, format, cjsDts, isMultiFormat) {
1107
1086
  const { Unused } = await import("unplugin-unused");
1108
1087
  plugins.push(Unused.rolldown(unused === true ? {} : unused));
1109
1088
  }
1110
- if (target) plugins.push(RuntimeHelperCheckPlugin(logger, target), await LightningCSSPlugin({ target }));
1111
- plugins.push(ShebangPlugin(logger, cwd, name, isMultiFormat), importGlobPlugin());
1089
+ if (target) plugins.push(await LightningCSSPlugin({ target }));
1090
+ plugins.push(ShebangPlugin(logger, cwd, name, isMultiFormat));
1091
+ if (globImport) plugins.push(importGlobPlugin());
1112
1092
  }
1113
1093
  if (report && LogLevels[logger.level] >= 3) plugins.push(ReportPlugin(report, logger, cwd, cjsDts, name, isMultiFormat));
1114
1094
  if (!cjsDts) plugins.push(userPlugins);
@@ -1136,7 +1116,8 @@ async function resolveInputOptions(config, format, cjsDts, isMultiFormat) {
1136
1116
  onLog: cjsDefault ? (level, log, defaultHandler) => {
1137
1117
  if (log.code === "MIXED_EXPORT") return;
1138
1118
  defaultHandler(level, log);
1139
- } : void 0
1119
+ } : void 0,
1120
+ experimental: { resolveNewUrlToAsset: true }
1140
1121
  }, config.inputOptions, [format, { cjsDts }]);
1141
1122
  }
1142
1123
  async function resolveOutputOptions(inputOptions, config, format, cjsDts) {
@@ -292,6 +292,9 @@ interface Options {
292
292
  */
293
293
  nodeProtocol?: "strip" | boolean;
294
294
  plugins?: InputOptions["plugins"];
295
+ /**
296
+ * Use with caution; ensure you understand the implications.
297
+ */
295
298
  inputOptions?: InputOptions | ((options: InputOptions, format: NormalizedFormat, context: {
296
299
  cjsDts: boolean;
297
300
  }) => Awaitable<InputOptions | void | null>);
@@ -347,6 +350,9 @@ interface Options {
347
350
  * @default true
348
351
  */
349
352
  cjsDefault?: boolean;
353
+ /**
354
+ * Use with caution; ensure you understand the implications.
355
+ */
350
356
  outputOptions?: OutputOptions | ((options: OutputOptions, format: NormalizedFormat, context: {
351
357
  cjsDts: boolean;
352
358
  }) => Awaitable<OutputOptions | void | null>);
@@ -438,6 +444,12 @@ interface Options {
438
444
  */
439
445
  report?: boolean | ReportOptions;
440
446
  /**
447
+ * `import.meta.glob` support.
448
+ * @see https://vite.dev/guide/features.html#glob-import
449
+ * @default true
450
+ */
451
+ globImport?: boolean;
452
+ /**
441
453
  * **[experimental]** Generate package exports for `package.json`.
442
454
  *
443
455
  * This will set the `main`, `module`, `types`, `exports` fields in `package.json`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdown",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "The Elegant Bundler for Libraries",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -72,7 +72,7 @@
72
72
  "ansis": "^4.1.0",
73
73
  "cac": "^6.7.14",
74
74
  "chokidar": "^4.0.3",
75
- "debug": "^4.4.1",
75
+ "debug": "^4.4.3",
76
76
  "diff": "^8.0.2",
77
77
  "empathic": "^2.0.0",
78
78
  "hookable": "^5.5.3",
@@ -88,9 +88,9 @@
88
88
  "@arethetypeswrong/core": "^0.18.2",
89
89
  "@sxzz/eslint-config": "^7.1.4",
90
90
  "@sxzz/prettier-config": "^2.2.4",
91
- "@sxzz/test-utils": "^0.5.10",
91
+ "@sxzz/test-utils": "^0.5.11",
92
92
  "@types/debug": "^4.1.12",
93
- "@types/node": "^24.3.1",
93
+ "@types/node": "^24.5.0",
94
94
  "@types/semver": "^7.7.1",
95
95
  "@unocss/eslint-plugin": "^66.5.1",
96
96
  "@vueuse/core": "^13.9.0",
@@ -103,7 +103,7 @@
103
103
  "tsx": "^4.20.5",
104
104
  "typescript": "~5.9.2",
105
105
  "unocss": "^66.5.1",
106
- "unplugin-lightningcss": "^0.4.2",
106
+ "unplugin-lightningcss": "^0.4.3",
107
107
  "unplugin-unused": "^0.5.3",
108
108
  "vite": "npm:rolldown-vite@latest",
109
109
  "vitest": "^3.2.4"
@@ -1,5 +0,0 @@
1
- //#region package.json
2
- var version = "0.15.1";
3
-
4
- //#endregion
5
- export { version };