tsdown 0.22.4 → 0.22.5
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/{build-CXv0CAc1.mjs → build-HsrEHUjF.mjs} +17 -15
- package/dist/{config-OWDxm8p5.d.mts → config-CA7V8dZs.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/{debug-CeGbjKZM.mjs → debug-DlW99neU.mjs} +1 -1
- package/dist/{format-COa2pUTn.mjs → format-V8jMDi-4.mjs} +11 -5
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/internal.d.mts +1 -1
- package/dist/logger-Dewu9aCG.d.mts +29 -0
- package/dist/{options-BFfWGQT3.mjs → options-C7WUFwSd.mjs} +1 -1
- package/dist/plugins.d.mts +2 -2
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +2 -2
- package/dist/{types-BmQCl9Kc.d.mts → types-n62VBdgE.d.mts} +299 -1
- package/dist/{watch-CvXOpI62.mjs → watch-CEWY-yCw.mjs} +1 -1
- package/package.json +16 -16
- package/dist/index-4SbnPhas.d.mts +0 -327
|
@@ -3,10 +3,10 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
|
3
3
|
import { r as fsRemove } from "./fs-qxJxxoCE.mjs";
|
|
4
4
|
import { a as pkgExists, l as slash, n as importWithError, o as promiseWithResolvers, t as debounce, u as toArray } from "./general-Cp4NiJNK.mjs";
|
|
5
5
|
import { a as globalLogger, t as LogLevels } from "./logger-BxuhTmAE.mjs";
|
|
6
|
-
import { a as getPackageType, c as isGlobEntry, d as cleanOutDir, i as loadConfigFile, l as toObjectEntry, n as mergeUserOptions, o as writeExports, r as resolveUserConfig, s as buildExe, t as mergeConfig, u as cleanChunks } from "./options-
|
|
7
|
-
import {
|
|
8
|
-
import { n as version } from "./debug-
|
|
9
|
-
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-
|
|
6
|
+
import { a as getPackageType, c as isGlobEntry, d as cleanOutDir, i as loadConfigFile, l as toObjectEntry, n as mergeUserOptions, o as writeExports, r as resolveUserConfig, s as buildExe, t as mergeConfig, u as cleanChunks } from "./options-C7WUFwSd.mjs";
|
|
7
|
+
import { i as getShims, n as DepsPlugin } from "./format-V8jMDi-4.mjs";
|
|
8
|
+
import { n as version } from "./debug-DlW99neU.mjs";
|
|
9
|
+
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-CEWY-yCw.mjs";
|
|
10
10
|
import { mkdtemp, readFile, readdir, writeFile } from "node:fs/promises";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
import process from "node:process";
|
|
@@ -458,15 +458,15 @@ function createChunkFilename(basename, jsExtension, dtsExtension) {
|
|
|
458
458
|
function resolveChunkAddon(chunkAddon, format) {
|
|
459
459
|
if (!chunkAddon) return;
|
|
460
460
|
return (chunk) => {
|
|
461
|
-
|
|
461
|
+
const resolved = typeof chunkAddon === "function" ? chunkAddon({
|
|
462
462
|
format,
|
|
463
463
|
fileName: chunk.fileName
|
|
464
|
-
});
|
|
465
|
-
if (typeof
|
|
464
|
+
}) : chunkAddon;
|
|
465
|
+
if (typeof resolved === "string") return resolved;
|
|
466
466
|
switch (true) {
|
|
467
|
-
case RE_JS.test(chunk.fileName): return
|
|
468
|
-
case RE_CSS.test(chunk.fileName): return
|
|
469
|
-
case RE_DTS.test(chunk.fileName): return
|
|
467
|
+
case RE_JS.test(chunk.fileName): return resolved?.js || "";
|
|
468
|
+
case RE_CSS.test(chunk.fileName): return resolved?.css || "";
|
|
469
|
+
case RE_DTS.test(chunk.fileName): return resolved?.dts || "";
|
|
470
470
|
default: return "";
|
|
471
471
|
}
|
|
472
472
|
};
|
|
@@ -486,7 +486,7 @@ async function getBuildOptions(config, format, configDeps, bundle, cjsDts = fals
|
|
|
486
486
|
return rolldownConfig;
|
|
487
487
|
}
|
|
488
488
|
async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, isDualFormat) {
|
|
489
|
-
const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig,
|
|
489
|
+
const { alias, checks: { legacyCjs, ...checks } = {}, cjsDefault, cwd, deps, devtools, dts, entry, env, globImport, loader, logger, nameLabel, nodeProtocol, platform, plugins: userPlugins, report, shims, target, treeshake, tsconfig, unused, watch } = config;
|
|
490
490
|
const loggerLevelIndex = LogLevels[logger.level];
|
|
491
491
|
const plugins = [];
|
|
492
492
|
if (nodeProtocol) plugins.push(NodeProtocolPlugin(nodeProtocol));
|
|
@@ -538,13 +538,15 @@ async function resolveInputOptions(config, format, configDeps, bundle, cjsDts, i
|
|
|
538
538
|
}, Object.create(null))
|
|
539
539
|
};
|
|
540
540
|
let inject;
|
|
541
|
-
if (shims && !cjsDts)
|
|
541
|
+
if (shims && !cjsDts) {
|
|
542
|
+
const shims = getShims(config);
|
|
543
|
+
inject = shims.inject;
|
|
542
544
|
define = {
|
|
543
545
|
...define,
|
|
544
|
-
...
|
|
546
|
+
...shims.define
|
|
545
547
|
};
|
|
546
|
-
plugins.push(
|
|
547
|
-
}
|
|
548
|
+
if (shims.plugin) plugins.push(shims.plugin);
|
|
549
|
+
}
|
|
548
550
|
const dtsExternal = deps.dts.neverBundle ? functionifyExternal(deps.dts.neverBundle) : void 0;
|
|
549
551
|
let external;
|
|
550
552
|
if (deps.neverBundle && dtsExternal) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-
|
|
1
|
+
import { d as UserConfig, f as UserConfigExport, i as InlineConfig, o as ResolvedConfig, p as UserConfigFn } from "./types-n62VBdgE.mjs";
|
|
2
2
|
//#region src/config/options.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Resolve user config into resolved configs
|
package/dist/config.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { d as UserConfig, f as UserConfigExport, p as UserConfigFn } from "./types-
|
|
2
|
-
import { n as mergeConfig, t as defineConfig } from "./config-
|
|
1
|
+
import { d as UserConfig, f as UserConfigExport, p as UserConfigFn } from "./types-n62VBdgE.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-CA7V8dZs.mjs";
|
|
3
3
|
export { type UserConfig, type UserConfigExport, type UserConfigFn, defineConfig, mergeConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as resolveComma, u as toArray } from "./general-Cp4NiJNK.mjs";
|
|
2
2
|
import { createDebug, enable, namespaces } from "obug";
|
|
3
3
|
//#region package.json
|
|
4
|
-
var version = "0.22.
|
|
4
|
+
var version = "0.22.5";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/features/debug.ts
|
|
7
7
|
const debugLog = createDebug("tsdown:debug");
|
|
@@ -8,6 +8,10 @@ import { RE_DTS, RE_NODE_MODULES } from "rolldown-plugin-dts/internal";
|
|
|
8
8
|
import { and, id, importerId, include } from "rolldown/filter";
|
|
9
9
|
//#region src/features/shims.ts
|
|
10
10
|
const shimFile = path.resolve(import.meta.dirname, "..", "esm-shims.js");
|
|
11
|
+
const shimsInject = {
|
|
12
|
+
__dirname: [shimFile, "__dirname"],
|
|
13
|
+
__filename: [shimFile, "__filename"]
|
|
14
|
+
};
|
|
11
15
|
const shimsDefine = {
|
|
12
16
|
__dirname: "__TSDOWN_SHIM_DIRNAME__",
|
|
13
17
|
__filename: "__TSDOWN_SHIM_FILENAME__"
|
|
@@ -22,11 +26,13 @@ const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPat
|
|
|
22
26
|
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
23
27
|
`
|
|
24
28
|
};
|
|
25
|
-
function
|
|
26
|
-
if (format
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
function getShims(config) {
|
|
30
|
+
if (config.format !== "es" || config.platform !== "node") return {};
|
|
31
|
+
if (config.unbundle) return {
|
|
32
|
+
define: shimsDefine,
|
|
33
|
+
plugin: shimsPlugin
|
|
29
34
|
};
|
|
35
|
+
return { inject: shimsInject };
|
|
30
36
|
}
|
|
31
37
|
//#endregion
|
|
32
38
|
//#region src/features/deps.ts
|
|
@@ -231,4 +237,4 @@ function formatBytes(bytes) {
|
|
|
231
237
|
return `${(bytes / 1e3).toFixed(2)} kB`;
|
|
232
238
|
}
|
|
233
239
|
//#endregion
|
|
234
|
-
export {
|
|
240
|
+
export { getShims as i, DepsPlugin as n, resolveDepsConfig as r, formatBytes as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as PackageType, B as ResolvedDepsConfig, C as ChunkAddon, D as OutExtensionFactory, E as OutExtensionContext, F as SeaConfig, G as CopyOptionsFn, H as TsdownBundle, I as DevtoolsOptions, L as DepsConfig, M as RolldownContext, N as TsdownHooks, O as OutExtensionObject, P as ExeOptions, S as AttwOptions, T as ChunkAddonObject, U as CopyEntry, V as RolldownChunk, W as CopyOptions, a as NormalizedFormat, b as PublintOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as BuildContext, k as PackageJsonWithPath, l as TsdownInputOption, m as WithEnabled, n as DtsOptions, o as ResolvedConfig, p as UserConfigFn, r as Format, s as Sourcemap, t as CIOption, u as UnusedOptions, v as TsdownPlugin, w as ChunkAddonFunction, x as ExportsOptions, y as TsdownPluginOption, z as NoExternalFn } from "./types-
|
|
3
|
-
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-
|
|
1
|
+
import { i as Arrayable, n as Logger, r as globalLogger } from "./logger-Dewu9aCG.mjs";
|
|
2
|
+
import { A as PackageType, B as ResolvedDepsConfig, C as ChunkAddon, D as OutExtensionFactory, E as OutExtensionContext, F as SeaConfig, G as CopyOptionsFn, H as TsdownBundle, I as DevtoolsOptions, L as DepsConfig, M as RolldownContext, N as TsdownHooks, O as OutExtensionObject, P as ExeOptions, S as AttwOptions, T as ChunkAddonObject, U as CopyEntry, V as RolldownChunk, W as CopyOptions, a as NormalizedFormat, b as PublintOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as BuildContext, k as PackageJsonWithPath, l as TsdownInputOption, m as WithEnabled, n as DtsOptions, o as ResolvedConfig, p as UserConfigFn, r as Format, s as Sourcemap, t as CIOption, u as UnusedOptions, v as TsdownPlugin, w as ChunkAddonFunction, x as ExportsOptions, y as TsdownPluginOption, z as NoExternalFn } from "./types-n62VBdgE.mjs";
|
|
3
|
+
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-CA7V8dZs.mjs";
|
|
4
4
|
import * as Rolldown from "rolldown";
|
|
5
5
|
//#region src/build.d.ts
|
|
6
6
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as buildWithConfigs, t as build } from "./build-
|
|
1
|
+
import { n as buildWithConfigs, t as build } from "./build-HsrEHUjF.mjs";
|
|
2
2
|
import { a as globalLogger } from "./logger-BxuhTmAE.mjs";
|
|
3
|
-
import { r as resolveUserConfig, t as mergeConfig } from "./options-
|
|
3
|
+
import { r as resolveUserConfig, t as mergeConfig } from "./options-C7WUFwSd.mjs";
|
|
4
4
|
import { defineConfig } from "./config.mjs";
|
|
5
|
-
import { n as version$1, t as enableDebug } from "./debug-
|
|
5
|
+
import { n as version$1, t as enableDebug } from "./debug-DlW99neU.mjs";
|
|
6
6
|
import * as Rolldown from "rolldown";
|
|
7
7
|
//#region src/index.ts
|
|
8
8
|
const version = version$1;
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as Logger, o as MarkPartial, s as Overwrite } from "./logger-Dewu9aCG.mjs";
|
|
2
2
|
//#region src/features/target.d.ts
|
|
3
3
|
declare function expandBaselineTarget(targets: string[]): string[];
|
|
4
4
|
//#endregion
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { InternalModuleFormat } from "rolldown";
|
|
2
|
+
//#region src/utils/types.d.ts
|
|
3
|
+
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
4
|
+
type Awaitable<T> = T | Promise<T>;
|
|
5
|
+
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
6
|
+
type Arrayable<T> = T | T[];
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/utils/logger.d.ts
|
|
9
|
+
type LogType = "error" | "warn" | "info";
|
|
10
|
+
type LogLevel = LogType | "silent";
|
|
11
|
+
interface LoggerOptions {
|
|
12
|
+
allowClearScreen?: boolean;
|
|
13
|
+
customLogger?: Logger;
|
|
14
|
+
console?: Console;
|
|
15
|
+
failOnWarn?: boolean;
|
|
16
|
+
}
|
|
17
|
+
interface Logger {
|
|
18
|
+
level: LogLevel;
|
|
19
|
+
options?: LoggerOptions;
|
|
20
|
+
info: (...args: any[]) => void;
|
|
21
|
+
warn: (...args: any[]) => void;
|
|
22
|
+
warnOnce: (...args: any[]) => void;
|
|
23
|
+
error: (...args: any[]) => void;
|
|
24
|
+
success: (...args: any[]) => void;
|
|
25
|
+
clearScreen: (type: LogType) => void;
|
|
26
|
+
}
|
|
27
|
+
declare const globalLogger: Logger;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Awaitable as a, Arrayable as i, Logger as n, MarkPartial as o, globalLogger as r, Overwrite as s, LogLevel as t };
|
|
@@ -3,7 +3,7 @@ const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
|
3
3
|
import { a as lowestCommonAncestor, i as fsStat, n as fsExists, o as stripExtname, r as fsRemove } from "./fs-qxJxxoCE.mjs";
|
|
4
4
|
import { a as pkgExists, c as resolveRegex, l as slash, n as importWithError, r as matchPattern, s as resolveComma, u as toArray } from "./general-Cp4NiJNK.mjs";
|
|
5
5
|
import { a as globalLogger, i as getNameLabel, n as createLogger, r as generateColor } from "./logger-BxuhTmAE.mjs";
|
|
6
|
-
import { r as resolveDepsConfig, t as formatBytes } from "./format-
|
|
6
|
+
import { r as resolveDepsConfig, t as formatBytes } from "./format-V8jMDi-4.mjs";
|
|
7
7
|
import { n as resolveTarget } from "./target-CqeSqtms.mjs";
|
|
8
8
|
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
9
9
|
import path from "node:path";
|
package/dist/plugins.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { H as TsdownBundle, R as DepsPlugin, _ as ReportPlugin } from "./types-
|
|
1
|
+
import { n as Logger } from "./logger-Dewu9aCG.mjs";
|
|
2
|
+
import { H as TsdownBundle, R as DepsPlugin, _ as ReportPlugin } from "./types-n62VBdgE.mjs";
|
|
3
3
|
import { Plugin } from "rolldown";
|
|
4
4
|
//#region src/features/node-protocol.d.ts
|
|
5
5
|
/**
|
package/dist/plugins.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { n as DepsPlugin } from "./format-
|
|
2
|
-
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-
|
|
1
|
+
import { n as DepsPlugin } from "./format-V8jMDi-4.mjs";
|
|
2
|
+
import { a as ReportPlugin, i as ShebangPlugin, o as NodeProtocolPlugin, t as WatchPlugin } from "./watch-CEWY-yCw.mjs";
|
|
3
3
|
export { DepsPlugin, NodeProtocolPlugin, ReportPlugin, ShebangPlugin, WatchPlugin };
|
package/dist/run.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as globalLogger } from "./logger-BxuhTmAE.mjs";
|
|
3
|
-
import { n as version, t as enableDebug } from "./debug-
|
|
3
|
+
import { n as version, t as enableDebug } from "./debug-DlW99neU.mjs";
|
|
4
4
|
import module from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { blue, hex } from "ansis";
|
|
@@ -16,7 +16,7 @@ cli.command("[...files]", "Bundle files", {
|
|
|
16
16
|
}).option("-c, --config <filename>", "Use a custom config file").option("--config-loader <loader>", "Config loader to use: auto, native, tsx, unrun", { default: "auto" }).option("--no-config", "Disable config file").option("-f, --format <format>", "Bundle format: esm, cjs, iife, umd", { default: "esm" }).option("--clean", "Clean output directory, --no-clean to disable").option("--deps.never-bundle <module>", "Mark dependencies as external").option("--minify", "Minify output").option("--devtools", "Enable devtools integration").option("--debug [feat]", "Show debug logs").option("--target <target>", "Bundle target, e.g \"es2015\", \"esnext\"").option("-l, --logLevel <level>", "Set log level: info, warn, error, silent").option("--fail-on-warn", "Fail on warnings", { default: true }).option("--no-write", "Disable writing files to disk, incompatible with watch mode").option("-d, --out-dir <dir>", "Output directory", { default: "dist" }).option("--treeshake", "Tree-shake bundle", { default: true }).option("--sourcemap", "Generate source map", { default: false }).option("--shims", "Enable cjs and esm shims ", { default: false }).option("--platform <platform>", "Target platform", { default: "node" }).option("--dts", "Generate dts files").option("--publint", "Enable publint", { default: false }).option("--attw", "Enable Are the types wrong integration", { default: false }).option("--unused", "Enable unused dependencies check", { default: false }).option("-w, --watch [path]", "Watch mode").option("--ignore-watch <path>", "Ignore custom paths in watch mode").option("--from-vite [vitest]", "Reuse config from Vite or Vitest").option("--report", "Size report", { default: true }).option("--env.* <value>", "Define compile-time env variables").option("--env-file <file>", "Load environment variables from a file, when used together with --env, variables in --env take precedence").option("--env-prefix <prefix>", "Prefix for env variables to inject into the bundle", { default: "TSDOWN_" }).option("--on-success <command>", "Command to run on success").option("--copy <dir>", "Copy files to output dir").option("--public-dir <dir>", "Alias for --copy, deprecated").option("--tsconfig <tsconfig>", "Set tsconfig path").option("--unbundle", "Unbundle mode").option("--root <dir>", "Root directory of input files").option("--exe", "Bundle as executable").option("-W, --workspace [dir]", "Enable workspace mode").option("-F, --filter <pattern>", "Filter configs (cwd or name), e.g. /pkg-name$/ or pkg-name").option("--exports", "Generate package exports for package.json").action(async (input, flags) => {
|
|
17
17
|
globalLogger.level = flags.logLevel || "info";
|
|
18
18
|
globalLogger.info(`${blue`tsdown v${version}`} powered by ${hex("#ff7e17")`rolldown v${VERSION}`}`);
|
|
19
|
-
const { build } = await import("./build-
|
|
19
|
+
const { build } = await import("./build-HsrEHUjF.mjs").then((n) => n.r);
|
|
20
20
|
if (input.length > 0) flags.entry = input;
|
|
21
21
|
await build(flags);
|
|
22
22
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as Awaitable, i as Arrayable, n as Logger, o as MarkPartial, s as Overwrite, t as LogLevel } from "./logger-Dewu9aCG.mjs";
|
|
2
2
|
import { BuildOptions, ChecksOptions, ExternalOption, InputOptions, InternalModuleFormat, MinifyOptions, ModuleFormat, ModuleTypes, OutputAsset, OutputChunk, OutputOptions, Plugin, RolldownPlugin, TreeshakingOptions } from "rolldown";
|
|
3
3
|
import { Hookable } from "hookable";
|
|
4
4
|
import { Buffer } from "node:buffer";
|
|
@@ -200,6 +200,304 @@ interface TsdownHooks {
|
|
|
200
200
|
}) => void | Promise<void>;
|
|
201
201
|
}
|
|
202
202
|
//#endregion
|
|
203
|
+
//#region node_modules/.pnpm/pkg-types@2.3.1/node_modules/pkg-types/dist/index.d.mts
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/packagejson/types.d.ts
|
|
206
|
+
interface PackageJson {
|
|
207
|
+
/**
|
|
208
|
+
* The name is what your thing is called.
|
|
209
|
+
* Some rules:
|
|
210
|
+
* - The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
|
|
211
|
+
* - The name can’t start with a dot or an underscore.
|
|
212
|
+
* - New packages must not have uppercase letters in the name.
|
|
213
|
+
* - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters.
|
|
214
|
+
*/
|
|
215
|
+
name?: string;
|
|
216
|
+
/**
|
|
217
|
+
* Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
|
|
218
|
+
*/
|
|
219
|
+
version?: string;
|
|
220
|
+
/**
|
|
221
|
+
* Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
|
|
222
|
+
*/
|
|
223
|
+
description?: string;
|
|
224
|
+
/**
|
|
225
|
+
* Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
|
|
226
|
+
*/
|
|
227
|
+
keywords?: string[];
|
|
228
|
+
/**
|
|
229
|
+
* The url to the project homepage.
|
|
230
|
+
*/
|
|
231
|
+
homepage?: string;
|
|
232
|
+
/**
|
|
233
|
+
* The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
|
|
234
|
+
*/
|
|
235
|
+
bugs?: string | {
|
|
236
|
+
url?: string;
|
|
237
|
+
email?: string;
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it.
|
|
241
|
+
*/
|
|
242
|
+
license?: string;
|
|
243
|
+
/**
|
|
244
|
+
* Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you.
|
|
245
|
+
* For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
|
|
246
|
+
*/
|
|
247
|
+
repository?: string | {
|
|
248
|
+
type: string;
|
|
249
|
+
url: string;
|
|
250
|
+
/**
|
|
251
|
+
* If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives:
|
|
252
|
+
*/
|
|
253
|
+
directory?: string;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package.
|
|
257
|
+
*/
|
|
258
|
+
scripts?: PackageJsonScripts;
|
|
259
|
+
/**
|
|
260
|
+
* If you set `"private": true` in your package.json, then npm will refuse to publish it.
|
|
261
|
+
*/
|
|
262
|
+
private?: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* The “author” is one person.
|
|
265
|
+
*/
|
|
266
|
+
author?: PackageJsonPerson;
|
|
267
|
+
/**
|
|
268
|
+
* “contributors” is an array of people.
|
|
269
|
+
*/
|
|
270
|
+
contributors?: PackageJsonPerson[];
|
|
271
|
+
/**
|
|
272
|
+
* An object containing a URL that provides up-to-date information
|
|
273
|
+
* about ways to help fund development of your package,
|
|
274
|
+
* a string URL, or an array of objects and string URLs
|
|
275
|
+
*/
|
|
276
|
+
funding?: PackageJsonFunding | PackageJsonFunding[];
|
|
277
|
+
/**
|
|
278
|
+
* The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files.
|
|
279
|
+
*/
|
|
280
|
+
files?: string[];
|
|
281
|
+
/**
|
|
282
|
+
* The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned.
|
|
283
|
+
* This should be a module ID relative to the root of your package folder.
|
|
284
|
+
* For most modules, it makes the most sense to have a main script and often not much else.
|
|
285
|
+
*/
|
|
286
|
+
main?: string;
|
|
287
|
+
/**
|
|
288
|
+
* If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
|
|
289
|
+
*/
|
|
290
|
+
browser?: string | Record<string, string | false>;
|
|
291
|
+
/**
|
|
292
|
+
* The `unpkg` field is used to specify the URL to a UMD module for your package. This is used by default in the unpkg.com CDN service.
|
|
293
|
+
*/
|
|
294
|
+
unpkg?: string;
|
|
295
|
+
/**
|
|
296
|
+
* A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs.
|
|
297
|
+
*/
|
|
298
|
+
bin?: string | Record<string, string>;
|
|
299
|
+
/**
|
|
300
|
+
* Specify either a single file or an array of filenames to put in place for the `man` program to find.
|
|
301
|
+
*/
|
|
302
|
+
man?: string | string[];
|
|
303
|
+
/**
|
|
304
|
+
* Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
|
|
305
|
+
*/
|
|
306
|
+
dependencies?: Record<string, string>;
|
|
307
|
+
/**
|
|
308
|
+
* If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use.
|
|
309
|
+
* In this case, it’s best to map these additional items in a `devDependencies` object.
|
|
310
|
+
*/
|
|
311
|
+
devDependencies?: Record<string, string>;
|
|
312
|
+
/**
|
|
313
|
+
* If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail.
|
|
314
|
+
*/
|
|
315
|
+
optionalDependencies?: Record<string, string>;
|
|
316
|
+
/**
|
|
317
|
+
* In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
|
|
318
|
+
*/
|
|
319
|
+
peerDependencies?: Record<string, string>;
|
|
320
|
+
/**
|
|
321
|
+
* TypeScript typings, typically ending by `.d.ts`.
|
|
322
|
+
*/
|
|
323
|
+
types?: string;
|
|
324
|
+
/**
|
|
325
|
+
* This field is synonymous with `types`.
|
|
326
|
+
*/
|
|
327
|
+
typings?: string;
|
|
328
|
+
/**
|
|
329
|
+
* Non-Standard Node.js alternate entry-point to main.
|
|
330
|
+
* An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
|
|
331
|
+
*/
|
|
332
|
+
module?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
|
|
335
|
+
*
|
|
336
|
+
* Docs:
|
|
337
|
+
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
|
|
338
|
+
*
|
|
339
|
+
* @default 'commonjs'
|
|
340
|
+
* @since Node.js v14
|
|
341
|
+
*/
|
|
342
|
+
type?: "module" | "commonjs";
|
|
343
|
+
/**
|
|
344
|
+
* Alternate and extensible alternative to "main" entry point.
|
|
345
|
+
*
|
|
346
|
+
* When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
|
|
347
|
+
*
|
|
348
|
+
* Docs:
|
|
349
|
+
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
|
|
350
|
+
*
|
|
351
|
+
* @since Node.js v12.7
|
|
352
|
+
*/
|
|
353
|
+
exports?: PackageJsonExports;
|
|
354
|
+
/**
|
|
355
|
+
* Docs:
|
|
356
|
+
* - https://nodejs.org/api/packages.html#imports
|
|
357
|
+
*/
|
|
358
|
+
imports?: Record<string, string | Record<string, string>>;
|
|
359
|
+
/**
|
|
360
|
+
* The field is used to define a set of sub-packages (or workspaces) within a monorepo.
|
|
361
|
+
*
|
|
362
|
+
* This field is an array of glob patterns or an object with specific configurations for managing
|
|
363
|
+
* multiple packages in a single repository.
|
|
364
|
+
*/
|
|
365
|
+
workspaces?: string[] | {
|
|
366
|
+
/**
|
|
367
|
+
* Workspace package paths. Glob patterns are supported.
|
|
368
|
+
*/
|
|
369
|
+
packages?: string[];
|
|
370
|
+
/**
|
|
371
|
+
* Packages to block from hoisting to the workspace root.
|
|
372
|
+
* Uses glob patterns to match module paths in the dependency tree.
|
|
373
|
+
*
|
|
374
|
+
* Docs:
|
|
375
|
+
* - https://classic.yarnpkg.com/blog/2018/02/15/nohoist/
|
|
376
|
+
*/
|
|
377
|
+
nohoist?: string[];
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* The field is used to specify different TypeScript declaration files for
|
|
381
|
+
* different versions of TypeScript, allowing for version-specific type definitions.
|
|
382
|
+
*/
|
|
383
|
+
typesVersions?: Record<string, Record<string, string[]>>;
|
|
384
|
+
/**
|
|
385
|
+
* You can specify which operating systems your module will run on:
|
|
386
|
+
* ```json
|
|
387
|
+
* {
|
|
388
|
+
* "os": ["darwin", "linux"]
|
|
389
|
+
* }
|
|
390
|
+
* ```
|
|
391
|
+
* You can also block instead of allowing operating systems, just prepend the blocked os with a '!':
|
|
392
|
+
* ```json
|
|
393
|
+
* {
|
|
394
|
+
* "os": ["!win32"]
|
|
395
|
+
* }
|
|
396
|
+
* ```
|
|
397
|
+
* The host operating system is determined by `process.platform`
|
|
398
|
+
* It is allowed to both block and allow an item, although there isn't any good reason to do this.
|
|
399
|
+
*/
|
|
400
|
+
os?: string[];
|
|
401
|
+
/**
|
|
402
|
+
* If your code only runs on certain cpu architectures, you can specify which ones.
|
|
403
|
+
* ```json
|
|
404
|
+
* {
|
|
405
|
+
* "cpu": ["x64", "ia32"]
|
|
406
|
+
* }
|
|
407
|
+
* ```
|
|
408
|
+
* Like the `os` option, you can also block architectures:
|
|
409
|
+
* ```json
|
|
410
|
+
* {
|
|
411
|
+
* "cpu": ["!arm", "!mips"]
|
|
412
|
+
* }
|
|
413
|
+
* ```
|
|
414
|
+
* The host architecture is determined by `process.arch`
|
|
415
|
+
*/
|
|
416
|
+
cpu?: string[];
|
|
417
|
+
/**
|
|
418
|
+
* This is a set of config values that will be used at publish-time.
|
|
419
|
+
*/
|
|
420
|
+
publishConfig?: {
|
|
421
|
+
/**
|
|
422
|
+
* The registry that will be used if the package is published.
|
|
423
|
+
*/
|
|
424
|
+
registry?: string;
|
|
425
|
+
/**
|
|
426
|
+
* The tag that will be used if the package is published.
|
|
427
|
+
*/
|
|
428
|
+
tag?: string;
|
|
429
|
+
/**
|
|
430
|
+
* The access level that will be used if the package is published.
|
|
431
|
+
*/
|
|
432
|
+
access?: "public" | "restricted";
|
|
433
|
+
/**
|
|
434
|
+
* **pnpm-only**
|
|
435
|
+
*
|
|
436
|
+
* By default, for portability reasons, no files except those listed in
|
|
437
|
+
* the bin field will be marked as executable in the resulting package
|
|
438
|
+
* archive. The executableFiles field lets you declare additional fields
|
|
439
|
+
* that must have the executable flag (+x) set even if
|
|
440
|
+
* they aren't directly accessible through the bin field.
|
|
441
|
+
*/
|
|
442
|
+
executableFiles?: string[];
|
|
443
|
+
/**
|
|
444
|
+
* **pnpm-only**
|
|
445
|
+
*
|
|
446
|
+
* You also can use the field `publishConfig.directory` to customize
|
|
447
|
+
* the published subdirectory relative to the current `package.json`.
|
|
448
|
+
*
|
|
449
|
+
* It is expected to have a modified version of the current package in
|
|
450
|
+
* the specified directory (usually using third party build tools).
|
|
451
|
+
*/
|
|
452
|
+
directory?: string;
|
|
453
|
+
/**
|
|
454
|
+
* **pnpm-only**
|
|
455
|
+
*
|
|
456
|
+
* When set to `true`, the project will be symlinked from the
|
|
457
|
+
* `publishConfig.directory` location during local development.
|
|
458
|
+
* @default true
|
|
459
|
+
*/
|
|
460
|
+
linkDirectory?: boolean;
|
|
461
|
+
} & Pick<PackageJson, "bin" | "main" | "exports" | "types" | "typings" | "module" | "browser" | "unpkg" | "typesVersions" | "os" | "cpu">;
|
|
462
|
+
/**
|
|
463
|
+
* See: https://nodejs.org/api/packages.html#packagemanager
|
|
464
|
+
* This field defines which package manager is expected to be used when working on the current project.
|
|
465
|
+
* Should be of the format: `<name>@<version>[#hash]`
|
|
466
|
+
*/
|
|
467
|
+
packageManager?: string;
|
|
468
|
+
[key: string]: any;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#pre--post-scripts
|
|
472
|
+
*/
|
|
473
|
+
type PackageJsonScriptWithPreAndPost<S extends string> = S | `${"pre" | "post"}${S}`;
|
|
474
|
+
/**
|
|
475
|
+
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-operation-order
|
|
476
|
+
*/
|
|
477
|
+
type PackageJsonNpmLifeCycleScripts = "dependencies" | "prepublishOnly" | PackageJsonScriptWithPreAndPost<"install" | "pack" | "prepare" | "publish" | "restart" | "start" | "stop" | "test" | "version">;
|
|
478
|
+
/**
|
|
479
|
+
* See: https://pnpm.io/scripts#lifecycle-scripts
|
|
480
|
+
*/
|
|
481
|
+
type PackageJsonPnpmLifeCycleScripts = "pnpm:devPreinstall";
|
|
482
|
+
type PackageJsonCommonScripts = "build" | "coverage" | "deploy" | "dev" | "format" | "lint" | "preview" | "release" | "typecheck" | "watch";
|
|
483
|
+
type PackageJsonScriptName = PackageJsonCommonScripts | PackageJsonNpmLifeCycleScripts | PackageJsonPnpmLifeCycleScripts | (string & {});
|
|
484
|
+
type PackageJsonScripts = { [P in PackageJsonScriptName]?: string; };
|
|
485
|
+
/**
|
|
486
|
+
* A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
|
|
487
|
+
*/
|
|
488
|
+
type PackageJsonPerson = string | {
|
|
489
|
+
name: string;
|
|
490
|
+
email?: string;
|
|
491
|
+
url?: string;
|
|
492
|
+
};
|
|
493
|
+
type PackageJsonFunding = string | {
|
|
494
|
+
url: string;
|
|
495
|
+
type?: string;
|
|
496
|
+
};
|
|
497
|
+
type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
|
|
498
|
+
type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>; };
|
|
499
|
+
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
500
|
+
//#endregion
|
|
203
501
|
//#region src/utils/package.d.ts
|
|
204
502
|
interface PackageJsonWithPath extends PackageJson {
|
|
205
503
|
packageJsonPath: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as fsExists, t as fsCopy } from "./fs-qxJxxoCE.mjs";
|
|
2
2
|
import { i as noop, s as resolveComma, u as toArray } from "./general-Cp4NiJNK.mjs";
|
|
3
3
|
import { o as prettyFormat } from "./logger-BxuhTmAE.mjs";
|
|
4
|
-
import { t as formatBytes } from "./format-
|
|
4
|
+
import { t as formatBytes } from "./format-V8jMDi-4.mjs";
|
|
5
5
|
import { builtinModules } from "node:module";
|
|
6
6
|
import { chmod } from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsdown",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.5",
|
|
5
5
|
"description": "The Elegant Bundler for Libraries",
|
|
6
6
|
"author": "Kevin Deng <sxzz@sxzz.moe>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"@vitejs/devtools": "*",
|
|
52
52
|
"publint": "^0.3.8",
|
|
53
53
|
"tsx": "*",
|
|
54
|
-
"typescript": "^5.0.0 || ^6.0.0",
|
|
54
|
+
"typescript": "^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
55
55
|
"unplugin-unused": "^0.5.0",
|
|
56
56
|
"unrun": "*",
|
|
57
|
-
"@tsdown/css": "0.22.
|
|
58
|
-
"@tsdown/exe": "0.22.
|
|
57
|
+
"@tsdown/css": "0.22.5",
|
|
58
|
+
"@tsdown/exe": "0.22.5"
|
|
59
59
|
},
|
|
60
60
|
"peerDependenciesMeta": {
|
|
61
61
|
"@arethetypeswrong/core": {
|
|
@@ -95,8 +95,8 @@
|
|
|
95
95
|
"import-without-cache": "^0.4.0",
|
|
96
96
|
"obug": "^2.1.3",
|
|
97
97
|
"picomatch": "^4.0.5",
|
|
98
|
-
"rolldown": "~1.1.
|
|
99
|
-
"rolldown-plugin-dts": "^0.27.
|
|
98
|
+
"rolldown": "~1.1.5",
|
|
99
|
+
"rolldown-plugin-dts": "^0.27.4",
|
|
100
100
|
"semver": "^7.8.5",
|
|
101
101
|
"tinyexec": "^1.2.4",
|
|
102
102
|
"tinyglobby": "^0.2.17",
|
|
@@ -108,15 +108,15 @@
|
|
|
108
108
|
"pkg-types": "2.3.1"
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@arethetypeswrong/core": "^0.18.
|
|
111
|
+
"@arethetypeswrong/core": "^0.18.5",
|
|
112
112
|
"@sxzz/eslint-config": "^8.2.1",
|
|
113
113
|
"@sxzz/prettier-config": "^2.3.1",
|
|
114
114
|
"@sxzz/test-utils": "^0.5.18",
|
|
115
|
-
"@types/node": "^26.1.
|
|
115
|
+
"@types/node": "^26.1.1",
|
|
116
116
|
"@types/picomatch": "^4.0.3",
|
|
117
117
|
"@types/semver": "^7.7.1",
|
|
118
|
-
"@typescript/native-preview": "npm:typescript@7.0.
|
|
119
|
-
"@unocss/eslint-plugin": "^66.7.
|
|
118
|
+
"@typescript/native-preview": "npm:typescript@7.0.2",
|
|
119
|
+
"@unocss/eslint-plugin": "^66.7.5",
|
|
120
120
|
"@vitejs/devtools": "^0.3.4",
|
|
121
121
|
"@vitest/coverage-v8": "^4.1.10",
|
|
122
122
|
"@vitest/ui": "^4.1.10",
|
|
@@ -126,29 +126,29 @@
|
|
|
126
126
|
"bumpp": "^11.1.0",
|
|
127
127
|
"dedent": "^1.7.2",
|
|
128
128
|
"eslint": "^10.6.0",
|
|
129
|
-
"memfs": "^4.
|
|
129
|
+
"memfs": "^4.64.0",
|
|
130
130
|
"package-manager-detector": "^1.7.0",
|
|
131
131
|
"pkg-types": "^2.3.1",
|
|
132
132
|
"postcss": "^8.5.16",
|
|
133
133
|
"postcss-import": "^16.1.1",
|
|
134
|
-
"prettier": "^3.9.
|
|
134
|
+
"prettier": "^3.9.5",
|
|
135
135
|
"publint": "^0.3.21",
|
|
136
136
|
"rolldown-plugin-require-cjs": "^0.4.1",
|
|
137
137
|
"sass": "^1.101.0",
|
|
138
138
|
"tsnapi": "^1.0.0",
|
|
139
139
|
"tsx": "^4.23.0",
|
|
140
140
|
"typescript": "~6.0.3",
|
|
141
|
-
"unocss": "^66.7.
|
|
141
|
+
"unocss": "^66.7.5",
|
|
142
142
|
"unplugin-ast": "^0.17.2",
|
|
143
143
|
"unplugin-raw": "^0.7.0",
|
|
144
144
|
"unplugin-unused": "^0.5.7",
|
|
145
145
|
"unplugin-vue": "^7.2.0",
|
|
146
146
|
"unrun": "^0.3.1",
|
|
147
|
-
"vite": "^8.1.
|
|
147
|
+
"vite": "^8.1.4",
|
|
148
148
|
"vitest": "^4.1.10",
|
|
149
149
|
"vue": "^3.5.39",
|
|
150
|
-
"@tsdown/css": "0.22.
|
|
151
|
-
"@tsdown/exe": "0.22.
|
|
150
|
+
"@tsdown/css": "0.22.5",
|
|
151
|
+
"@tsdown/exe": "0.22.5"
|
|
152
152
|
},
|
|
153
153
|
"prettier": "@sxzz/prettier-config",
|
|
154
154
|
"scripts": {
|
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import { InternalModuleFormat } from "rolldown";
|
|
2
|
-
//#region src/utils/types.d.ts
|
|
3
|
-
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
4
|
-
type Awaitable<T> = T | Promise<T>;
|
|
5
|
-
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
6
|
-
type Arrayable<T> = T | T[];
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/utils/logger.d.ts
|
|
9
|
-
type LogType = "error" | "warn" | "info";
|
|
10
|
-
type LogLevel = LogType | "silent";
|
|
11
|
-
interface LoggerOptions {
|
|
12
|
-
allowClearScreen?: boolean;
|
|
13
|
-
customLogger?: Logger;
|
|
14
|
-
console?: Console;
|
|
15
|
-
failOnWarn?: boolean;
|
|
16
|
-
}
|
|
17
|
-
interface Logger {
|
|
18
|
-
level: LogLevel;
|
|
19
|
-
options?: LoggerOptions;
|
|
20
|
-
info: (...args: any[]) => void;
|
|
21
|
-
warn: (...args: any[]) => void;
|
|
22
|
-
warnOnce: (...args: any[]) => void;
|
|
23
|
-
error: (...args: any[]) => void;
|
|
24
|
-
success: (...args: any[]) => void;
|
|
25
|
-
clearScreen: (type: LogType) => void;
|
|
26
|
-
}
|
|
27
|
-
declare const globalLogger: Logger;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region node_modules/.pnpm/pkg-types@2.3.1/node_modules/pkg-types/dist/index.d.mts
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region src/packagejson/types.d.ts
|
|
32
|
-
interface PackageJson {
|
|
33
|
-
/**
|
|
34
|
-
* The name is what your thing is called.
|
|
35
|
-
* Some rules:
|
|
36
|
-
* - The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
|
|
37
|
-
* - The name can’t start with a dot or an underscore.
|
|
38
|
-
* - New packages must not have uppercase letters in the name.
|
|
39
|
-
* - The name ends up being part of a URL, an argument on the command line, and a folder name. Therefore, the name can’t contain any non-URL-safe characters.
|
|
40
|
-
*/
|
|
41
|
-
name?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
|
|
44
|
-
*/
|
|
45
|
-
version?: string;
|
|
46
|
-
/**
|
|
47
|
-
* Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
|
|
48
|
-
*/
|
|
49
|
-
description?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
|
|
52
|
-
*/
|
|
53
|
-
keywords?: string[];
|
|
54
|
-
/**
|
|
55
|
-
* The url to the project homepage.
|
|
56
|
-
*/
|
|
57
|
-
homepage?: string;
|
|
58
|
-
/**
|
|
59
|
-
* The url to your project’s issue tracker and / or the email address to which issues should be reported. These are helpful for people who encounter issues with your package.
|
|
60
|
-
*/
|
|
61
|
-
bugs?: string | {
|
|
62
|
-
url?: string;
|
|
63
|
-
email?: string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it.
|
|
67
|
-
*/
|
|
68
|
-
license?: string;
|
|
69
|
-
/**
|
|
70
|
-
* Specify the place where your code lives. This is helpful for people who want to contribute. If the git repo is on GitHub, then the `npm docs` command will be able to find you.
|
|
71
|
-
* For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
|
|
72
|
-
*/
|
|
73
|
-
repository?: string | {
|
|
74
|
-
type: string;
|
|
75
|
-
url: string;
|
|
76
|
-
/**
|
|
77
|
-
* If the `package.json` for your package is not in the root directory (for example if it is part of a monorepo), you can specify the directory in which it lives:
|
|
78
|
-
*/
|
|
79
|
-
directory?: string;
|
|
80
|
-
};
|
|
81
|
-
/**
|
|
82
|
-
* The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package.
|
|
83
|
-
*/
|
|
84
|
-
scripts?: PackageJsonScripts;
|
|
85
|
-
/**
|
|
86
|
-
* If you set `"private": true` in your package.json, then npm will refuse to publish it.
|
|
87
|
-
*/
|
|
88
|
-
private?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* The “author” is one person.
|
|
91
|
-
*/
|
|
92
|
-
author?: PackageJsonPerson;
|
|
93
|
-
/**
|
|
94
|
-
* “contributors” is an array of people.
|
|
95
|
-
*/
|
|
96
|
-
contributors?: PackageJsonPerson[];
|
|
97
|
-
/**
|
|
98
|
-
* An object containing a URL that provides up-to-date information
|
|
99
|
-
* about ways to help fund development of your package,
|
|
100
|
-
* a string URL, or an array of objects and string URLs
|
|
101
|
-
*/
|
|
102
|
-
funding?: PackageJsonFunding | PackageJsonFunding[];
|
|
103
|
-
/**
|
|
104
|
-
* The optional `files` field is an array of file patterns that describes the entries to be included when your package is installed as a dependency. File patterns follow a similar syntax to `.gitignore`, but reversed: including a file, directory, or glob pattern (`*`, `**\/*`, and such) will make it so that file is included in the tarball when it’s packed. Omitting the field will make it default to `["*"]`, which means it will include all files.
|
|
105
|
-
*/
|
|
106
|
-
files?: string[];
|
|
107
|
-
/**
|
|
108
|
-
* The main field is a module ID that is the primary entry point to your program. That is, if your package is named `foo`, and a user installs it, and then does `require("foo")`, then your main module’s exports object will be returned.
|
|
109
|
-
* This should be a module ID relative to the root of your package folder.
|
|
110
|
-
* For most modules, it makes the most sense to have a main script and often not much else.
|
|
111
|
-
*/
|
|
112
|
-
main?: string;
|
|
113
|
-
/**
|
|
114
|
-
* If your module is meant to be used client-side the browser field should be used instead of the main field. This is helpful to hint users that it might rely on primitives that aren’t available in Node.js modules. (e.g. window)
|
|
115
|
-
*/
|
|
116
|
-
browser?: string | Record<string, string | false>;
|
|
117
|
-
/**
|
|
118
|
-
* The `unpkg` field is used to specify the URL to a UMD module for your package. This is used by default in the unpkg.com CDN service.
|
|
119
|
-
*/
|
|
120
|
-
unpkg?: string;
|
|
121
|
-
/**
|
|
122
|
-
* A map of command name to local file name. On install, npm will symlink that file into `prefix/bin` for global installs, or `./node_modules/.bin/` for local installs.
|
|
123
|
-
*/
|
|
124
|
-
bin?: string | Record<string, string>;
|
|
125
|
-
/**
|
|
126
|
-
* Specify either a single file or an array of filenames to put in place for the `man` program to find.
|
|
127
|
-
*/
|
|
128
|
-
man?: string | string[];
|
|
129
|
-
/**
|
|
130
|
-
* Dependencies are specified in a simple object that maps a package name to a version range. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or git URL.
|
|
131
|
-
*/
|
|
132
|
-
dependencies?: Record<string, string>;
|
|
133
|
-
/**
|
|
134
|
-
* If someone is planning on downloading and using your module in their program, then they probably don’t want or need to download and build the external test or documentation framework that you use.
|
|
135
|
-
* In this case, it’s best to map these additional items in a `devDependencies` object.
|
|
136
|
-
*/
|
|
137
|
-
devDependencies?: Record<string, string>;
|
|
138
|
-
/**
|
|
139
|
-
* If a dependency can be used, but you would like npm to proceed if it cannot be found or fails to install, then you may put it in the `optionalDependencies` object. This is a map of package name to version or url, just like the `dependencies` object. The difference is that build failures do not cause installation to fail.
|
|
140
|
-
*/
|
|
141
|
-
optionalDependencies?: Record<string, string>;
|
|
142
|
-
/**
|
|
143
|
-
* In some cases, you want to express the compatibility of your package with a host tool or library, while not necessarily doing a `require` of this host. This is usually referred to as a plugin. Notably, your module may be exposing a specific interface, expected and specified by the host documentation.
|
|
144
|
-
*/
|
|
145
|
-
peerDependencies?: Record<string, string>;
|
|
146
|
-
/**
|
|
147
|
-
* TypeScript typings, typically ending by `.d.ts`.
|
|
148
|
-
*/
|
|
149
|
-
types?: string;
|
|
150
|
-
/**
|
|
151
|
-
* This field is synonymous with `types`.
|
|
152
|
-
*/
|
|
153
|
-
typings?: string;
|
|
154
|
-
/**
|
|
155
|
-
* Non-Standard Node.js alternate entry-point to main.
|
|
156
|
-
* An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
|
|
157
|
-
*/
|
|
158
|
-
module?: string;
|
|
159
|
-
/**
|
|
160
|
-
* Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
|
|
161
|
-
*
|
|
162
|
-
* Docs:
|
|
163
|
-
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
|
|
164
|
-
*
|
|
165
|
-
* @default 'commonjs'
|
|
166
|
-
* @since Node.js v14
|
|
167
|
-
*/
|
|
168
|
-
type?: "module" | "commonjs";
|
|
169
|
-
/**
|
|
170
|
-
* Alternate and extensible alternative to "main" entry point.
|
|
171
|
-
*
|
|
172
|
-
* When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
|
|
173
|
-
*
|
|
174
|
-
* Docs:
|
|
175
|
-
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
|
|
176
|
-
*
|
|
177
|
-
* @since Node.js v12.7
|
|
178
|
-
*/
|
|
179
|
-
exports?: PackageJsonExports;
|
|
180
|
-
/**
|
|
181
|
-
* Docs:
|
|
182
|
-
* - https://nodejs.org/api/packages.html#imports
|
|
183
|
-
*/
|
|
184
|
-
imports?: Record<string, string | Record<string, string>>;
|
|
185
|
-
/**
|
|
186
|
-
* The field is used to define a set of sub-packages (or workspaces) within a monorepo.
|
|
187
|
-
*
|
|
188
|
-
* This field is an array of glob patterns or an object with specific configurations for managing
|
|
189
|
-
* multiple packages in a single repository.
|
|
190
|
-
*/
|
|
191
|
-
workspaces?: string[] | {
|
|
192
|
-
/**
|
|
193
|
-
* Workspace package paths. Glob patterns are supported.
|
|
194
|
-
*/
|
|
195
|
-
packages?: string[];
|
|
196
|
-
/**
|
|
197
|
-
* Packages to block from hoisting to the workspace root.
|
|
198
|
-
* Uses glob patterns to match module paths in the dependency tree.
|
|
199
|
-
*
|
|
200
|
-
* Docs:
|
|
201
|
-
* - https://classic.yarnpkg.com/blog/2018/02/15/nohoist/
|
|
202
|
-
*/
|
|
203
|
-
nohoist?: string[];
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* The field is used to specify different TypeScript declaration files for
|
|
207
|
-
* different versions of TypeScript, allowing for version-specific type definitions.
|
|
208
|
-
*/
|
|
209
|
-
typesVersions?: Record<string, Record<string, string[]>>;
|
|
210
|
-
/**
|
|
211
|
-
* You can specify which operating systems your module will run on:
|
|
212
|
-
* ```json
|
|
213
|
-
* {
|
|
214
|
-
* "os": ["darwin", "linux"]
|
|
215
|
-
* }
|
|
216
|
-
* ```
|
|
217
|
-
* You can also block instead of allowing operating systems, just prepend the blocked os with a '!':
|
|
218
|
-
* ```json
|
|
219
|
-
* {
|
|
220
|
-
* "os": ["!win32"]
|
|
221
|
-
* }
|
|
222
|
-
* ```
|
|
223
|
-
* The host operating system is determined by `process.platform`
|
|
224
|
-
* It is allowed to both block and allow an item, although there isn't any good reason to do this.
|
|
225
|
-
*/
|
|
226
|
-
os?: string[];
|
|
227
|
-
/**
|
|
228
|
-
* If your code only runs on certain cpu architectures, you can specify which ones.
|
|
229
|
-
* ```json
|
|
230
|
-
* {
|
|
231
|
-
* "cpu": ["x64", "ia32"]
|
|
232
|
-
* }
|
|
233
|
-
* ```
|
|
234
|
-
* Like the `os` option, you can also block architectures:
|
|
235
|
-
* ```json
|
|
236
|
-
* {
|
|
237
|
-
* "cpu": ["!arm", "!mips"]
|
|
238
|
-
* }
|
|
239
|
-
* ```
|
|
240
|
-
* The host architecture is determined by `process.arch`
|
|
241
|
-
*/
|
|
242
|
-
cpu?: string[];
|
|
243
|
-
/**
|
|
244
|
-
* This is a set of config values that will be used at publish-time.
|
|
245
|
-
*/
|
|
246
|
-
publishConfig?: {
|
|
247
|
-
/**
|
|
248
|
-
* The registry that will be used if the package is published.
|
|
249
|
-
*/
|
|
250
|
-
registry?: string;
|
|
251
|
-
/**
|
|
252
|
-
* The tag that will be used if the package is published.
|
|
253
|
-
*/
|
|
254
|
-
tag?: string;
|
|
255
|
-
/**
|
|
256
|
-
* The access level that will be used if the package is published.
|
|
257
|
-
*/
|
|
258
|
-
access?: "public" | "restricted";
|
|
259
|
-
/**
|
|
260
|
-
* **pnpm-only**
|
|
261
|
-
*
|
|
262
|
-
* By default, for portability reasons, no files except those listed in
|
|
263
|
-
* the bin field will be marked as executable in the resulting package
|
|
264
|
-
* archive. The executableFiles field lets you declare additional fields
|
|
265
|
-
* that must have the executable flag (+x) set even if
|
|
266
|
-
* they aren't directly accessible through the bin field.
|
|
267
|
-
*/
|
|
268
|
-
executableFiles?: string[];
|
|
269
|
-
/**
|
|
270
|
-
* **pnpm-only**
|
|
271
|
-
*
|
|
272
|
-
* You also can use the field `publishConfig.directory` to customize
|
|
273
|
-
* the published subdirectory relative to the current `package.json`.
|
|
274
|
-
*
|
|
275
|
-
* It is expected to have a modified version of the current package in
|
|
276
|
-
* the specified directory (usually using third party build tools).
|
|
277
|
-
*/
|
|
278
|
-
directory?: string;
|
|
279
|
-
/**
|
|
280
|
-
* **pnpm-only**
|
|
281
|
-
*
|
|
282
|
-
* When set to `true`, the project will be symlinked from the
|
|
283
|
-
* `publishConfig.directory` location during local development.
|
|
284
|
-
* @default true
|
|
285
|
-
*/
|
|
286
|
-
linkDirectory?: boolean;
|
|
287
|
-
} & Pick<PackageJson, "bin" | "main" | "exports" | "types" | "typings" | "module" | "browser" | "unpkg" | "typesVersions" | "os" | "cpu">;
|
|
288
|
-
/**
|
|
289
|
-
* See: https://nodejs.org/api/packages.html#packagemanager
|
|
290
|
-
* This field defines which package manager is expected to be used when working on the current project.
|
|
291
|
-
* Should be of the format: `<name>@<version>[#hash]`
|
|
292
|
-
*/
|
|
293
|
-
packageManager?: string;
|
|
294
|
-
[key: string]: any;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#pre--post-scripts
|
|
298
|
-
*/
|
|
299
|
-
type PackageJsonScriptWithPreAndPost<S extends string> = S | `${"pre" | "post"}${S}`;
|
|
300
|
-
/**
|
|
301
|
-
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-operation-order
|
|
302
|
-
*/
|
|
303
|
-
type PackageJsonNpmLifeCycleScripts = "dependencies" | "prepublishOnly" | PackageJsonScriptWithPreAndPost<"install" | "pack" | "prepare" | "publish" | "restart" | "start" | "stop" | "test" | "version">;
|
|
304
|
-
/**
|
|
305
|
-
* See: https://pnpm.io/scripts#lifecycle-scripts
|
|
306
|
-
*/
|
|
307
|
-
type PackageJsonPnpmLifeCycleScripts = "pnpm:devPreinstall";
|
|
308
|
-
type PackageJsonCommonScripts = "build" | "coverage" | "deploy" | "dev" | "format" | "lint" | "preview" | "release" | "typecheck" | "watch";
|
|
309
|
-
type PackageJsonScriptName = PackageJsonCommonScripts | PackageJsonNpmLifeCycleScripts | PackageJsonPnpmLifeCycleScripts | (string & {});
|
|
310
|
-
type PackageJsonScripts = { [P in PackageJsonScriptName]?: string; };
|
|
311
|
-
/**
|
|
312
|
-
* A “person” is an object with a “name” field and optionally “url” and “email”. Or you can shorten that all into a single string, and npm will parse it for you.
|
|
313
|
-
*/
|
|
314
|
-
type PackageJsonPerson = string | {
|
|
315
|
-
name: string;
|
|
316
|
-
email?: string;
|
|
317
|
-
url?: string;
|
|
318
|
-
};
|
|
319
|
-
type PackageJsonFunding = string | {
|
|
320
|
-
url: string;
|
|
321
|
-
type?: string;
|
|
322
|
-
};
|
|
323
|
-
type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
|
|
324
|
-
type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>; };
|
|
325
|
-
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
326
|
-
//#endregion
|
|
327
|
-
export { Arrayable as a, Overwrite as c, globalLogger as i, LogLevel as n, Awaitable as o, Logger as r, MarkPartial as s, PackageJson as t };
|