tsdown 0.21.6 → 0.21.8
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-MDnn2xGL.mjs → build-y6nUUkVJ.mjs} +43 -27
- package/dist/{config-CgCV7Kdu.d.mts → config-BjpbFAQr.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +1 -1
- package/dist/{debug-C4FmgzkJ.mjs → debug-CLlnG64L.mjs} +1 -1
- package/dist/{format-DXnmiQIy.mjs → format-a5Q6w07o.mjs} +6 -2
- package/dist/{general-CRszZCrY.mjs → general-D3muxt2f.mjs} +3 -11
- package/dist/index-DraNj4FA.d.mts +331 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +4 -4
- package/dist/internal.d.mts +6 -3
- package/dist/internal.mjs +3 -2
- package/dist/{logger-BU0v7CAk.mjs → logger-uV8l1UFa.mjs} +1 -1
- package/dist/{options-B1Ye5hV8.mjs → options-CAjSicbD.mjs} +7 -28
- package/dist/{package-lMx2nkh2.mjs → package-yVk5dXcU.mjs} +1 -1
- package/dist/plugins.d.mts +2 -2
- package/dist/plugins.mjs +2 -2
- package/dist/run.mjs +4 -4
- package/dist/target-s30wya8e.mjs +37 -0
- package/dist/{types-qUp2BCEq.d.mts → types-C7s2EXSK.d.mts} +24 -307
- package/dist/{watch-BHPVmWIr.mjs → watch-C9ZHIctp.mjs} +3 -3
- package/package.json +30 -29
- package/dist/build-C1dAKhHj.mjs +0 -2
- package/dist/logger-DtCm1ySP.d.mts +0 -30
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
2
|
const __cjs_require = __cjs_createRequire(import.meta.url);
|
|
3
|
-
import { a as
|
|
4
|
-
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-B1Ye5hV8.mjs";
|
|
3
|
+
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-CAjSicbD.mjs";
|
|
5
4
|
import { r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
6
|
-
import { a as
|
|
7
|
-
import { a as
|
|
8
|
-
import { a as
|
|
9
|
-
import { t as
|
|
5
|
+
import { a as pkgExists, l as slash, n as importWithError, o as promiseWithResolvers, t as debounce } from "./general-D3muxt2f.mjs";
|
|
6
|
+
import { a as globalLogger, t as LogLevels } from "./logger-uV8l1UFa.mjs";
|
|
7
|
+
import { a as getShimsInject, r as DepsPlugin } from "./format-a5Q6w07o.mjs";
|
|
8
|
+
import { a as ReportPlugin, i as ShebangPlugin, n as endsWithConfig, o as NodeProtocolPlugin, r as addOutDirToChunks, s as copy, t as WatchPlugin } from "./watch-C9ZHIctp.mjs";
|
|
9
|
+
import { t as version } from "./package-yVk5dXcU.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";
|
|
@@ -25,6 +25,18 @@ import { Hookable } from "hookable";
|
|
|
25
25
|
const treeKill = __cjs_require("tree-kill");
|
|
26
26
|
import { formatWithOptions, inspect } from "node:util";
|
|
27
27
|
import { importGlobPlugin } from "rolldown/experimental";
|
|
28
|
+
//#region \0rolldown/runtime.js
|
|
29
|
+
var __defProp = Object.defineProperty;
|
|
30
|
+
var __exportAll = (all, no_symbols) => {
|
|
31
|
+
let target = {};
|
|
32
|
+
for (var name in all) __defProp(target, name, {
|
|
33
|
+
get: all[name],
|
|
34
|
+
enumerable: true
|
|
35
|
+
});
|
|
36
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
37
|
+
return target;
|
|
38
|
+
};
|
|
39
|
+
//#endregion
|
|
28
40
|
//#region src/config/workspace.ts
|
|
29
41
|
const debug$4 = createDebug("tsdown:config:workspace");
|
|
30
42
|
const DEFAULT_EXCLUDE_WORKSPACE = [
|
|
@@ -110,6 +122,23 @@ function warnLegacyCJS(config) {
|
|
|
110
122
|
return version && satisfies(version, "^20.19.0 || >=22.12.0");
|
|
111
123
|
})) config.logger.warnOnce("We recommend using the ESM format instead of CommonJS.\nThe ESM format is compatible with modern platforms and runtimes, and most new libraries are now distributed only in ESM format.\nLearn more at https://nodejs.org/en/learn/modules/publishing-a-package#how-did-we-get-here");
|
|
112
124
|
}
|
|
125
|
+
function CjsDtsReexportPlugin() {
|
|
126
|
+
return {
|
|
127
|
+
name: "tsdown:cjs-dts-reexport",
|
|
128
|
+
generateBundle(_options, bundle) {
|
|
129
|
+
for (const chunk of Object.values(bundle)) {
|
|
130
|
+
if (chunk.type !== "chunk" || !chunk.isEntry) continue;
|
|
131
|
+
if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
|
|
132
|
+
const content = `export type * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
|
|
133
|
+
this.emitFile({
|
|
134
|
+
type: "prebuilt-chunk",
|
|
135
|
+
fileName: filename_js_to_dts(chunk.fileName),
|
|
136
|
+
code: content
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
113
142
|
//#endregion
|
|
114
143
|
//#region src/features/devtools.ts
|
|
115
144
|
async function startDevtoolsUI(config) {
|
|
@@ -192,7 +221,7 @@ async function attw(options, tarball) {
|
|
|
192
221
|
if (invalidRules.length) options.logger.warn(`attw config option 'ignoreRules' contains invalid value '${invalidRules.join(", ")}'.`);
|
|
193
222
|
const t = performance.now();
|
|
194
223
|
debug$2("Running attw check");
|
|
195
|
-
const attwCore = await importWithError("@arethetypeswrong/core"
|
|
224
|
+
const attwCore = options.attw.module || await importWithError("@arethetypeswrong/core");
|
|
196
225
|
const pkg = attwCore.createPackageFromTarballData(tarball);
|
|
197
226
|
const checkResult = await attwCore.checkPackage(pkg, attwOptions);
|
|
198
227
|
let errorMessage;
|
|
@@ -244,8 +273,8 @@ async function publint(options, tarball) {
|
|
|
244
273
|
}
|
|
245
274
|
const t = performance.now();
|
|
246
275
|
debug$1("Running publint");
|
|
247
|
-
const { publint } = await importWithError("publint"
|
|
248
|
-
const { formatMessage } = await importWithError("publint/utils"
|
|
276
|
+
const { publint } = options.publint.module?.[0] || await importWithError("publint");
|
|
277
|
+
const { formatMessage } = options.publint.module?.[1] || await importWithError("publint/utils");
|
|
249
278
|
const { messages } = await publint({
|
|
250
279
|
...options.publint,
|
|
251
280
|
pack: { tarball: tarball.buffer }
|
|
@@ -587,23 +616,6 @@ function handlePluginInspect(plugins) {
|
|
|
587
616
|
else return `"rolldown plugin: ${plugins.name}"`;
|
|
588
617
|
};
|
|
589
618
|
}
|
|
590
|
-
function CjsDtsReexportPlugin() {
|
|
591
|
-
return {
|
|
592
|
-
name: "tsdown:cjs-dts-reexport",
|
|
593
|
-
generateBundle(_options, bundle) {
|
|
594
|
-
for (const chunk of Object.values(bundle)) {
|
|
595
|
-
if (chunk.type !== "chunk") continue;
|
|
596
|
-
if (!chunk.fileName.endsWith(".cjs") && !chunk.fileName.endsWith(".js")) continue;
|
|
597
|
-
const content = `export * from './${path.basename(chunk.fileName.replace(RE_JS, ".d.mts"))}'\n`;
|
|
598
|
-
this.emitFile({
|
|
599
|
-
type: "prebuilt-chunk",
|
|
600
|
-
fileName: filename_js_to_dts(chunk.fileName),
|
|
601
|
-
code: content
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
619
|
function CssGuardPlugin() {
|
|
608
620
|
return {
|
|
609
621
|
name: "tsdown:css-guard",
|
|
@@ -669,6 +681,10 @@ function shortcuts(restart) {
|
|
|
669
681
|
}
|
|
670
682
|
//#endregion
|
|
671
683
|
//#region src/build.ts
|
|
684
|
+
var build_exports = /* @__PURE__ */ __exportAll({
|
|
685
|
+
build: () => build$1,
|
|
686
|
+
buildWithConfigs: () => buildWithConfigs
|
|
687
|
+
});
|
|
672
688
|
const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
|
|
673
689
|
/**
|
|
674
690
|
* Build with tsdown.
|
|
@@ -832,4 +848,4 @@ async function buildSingle(config, configFiles, isDualFormat, clean, restart, do
|
|
|
832
848
|
}
|
|
833
849
|
}
|
|
834
850
|
//#endregion
|
|
835
|
-
export { buildWithConfigs as n, build$1 as t };
|
|
851
|
+
export { buildWithConfigs as n, build_exports as r, build$1 as t };
|
|
@@ -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-C7s2EXSK.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/config/options.d.ts
|
|
4
4
|
/**
|
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-C7s2EXSK.mjs";
|
|
2
|
+
import { n as mergeConfig, t as defineConfig } from "./config-BjpbFAQr.mjs";
|
|
3
3
|
export { UserConfig, UserConfigExport, UserConfigFn, defineConfig, mergeConfig };
|
package/dist/config.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { s as resolveComma, u as toArray } from "./general-
|
|
1
|
+
import { s as resolveComma, u as toArray } from "./general-D3muxt2f.mjs";
|
|
2
2
|
import { createDebug, enable, namespaces } from "obug";
|
|
3
3
|
//#region src/features/debug.ts
|
|
4
4
|
const debugLog = createDebug("tsdown:debug");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as resolveRegex, l as slash, r as matchPattern, u as toArray } from "./general-
|
|
1
|
+
import { c as resolveRegex, l as slash, r as matchPattern, u as toArray } from "./general-D3muxt2f.mjs";
|
|
2
2
|
import { isBuiltin } from "node:module";
|
|
3
3
|
import { readFile } from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
@@ -98,6 +98,7 @@ function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBund
|
|
|
98
98
|
for (const chunk of Object.values(bundle)) {
|
|
99
99
|
if (chunk.type === "asset") continue;
|
|
100
100
|
for (const id of chunk.moduleIds) {
|
|
101
|
+
if (id === shimFile) continue;
|
|
101
102
|
const parsed = await readBundledDepInfo(id);
|
|
102
103
|
if (!parsed) continue;
|
|
103
104
|
deps.add(parsed.name);
|
|
@@ -127,7 +128,10 @@ function DepsPlugin({ pkg, deps: { alwaysBundle, onlyBundle, skipNodeModulesBund
|
|
|
127
128
|
async function externalStrategy(id, importer, resolved) {
|
|
128
129
|
if (id === shimFile) return false;
|
|
129
130
|
if (alwaysBundle?.(id, importer)) return "no-external";
|
|
130
|
-
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id)))
|
|
131
|
+
if (skipNodeModulesBundle && resolved && (resolved.external || RE_NODE_MODULES.test(resolved.id))) {
|
|
132
|
+
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
133
|
+
return resolvedDep ? [true, resolvedDep] : true;
|
|
134
|
+
}
|
|
131
135
|
if (deps) {
|
|
132
136
|
if (deps.includes(id) || deps.some((dep) => id.startsWith(`${dep}/`))) {
|
|
133
137
|
const resolvedDep = await resolveDepSubpath(id, resolved);
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { createRequire as __cjs_createRequire } from "node:module";
|
|
2
|
-
const
|
|
3
|
-
import { createRequire } from "node:module";
|
|
4
|
-
import { pathToFileURL } from "node:url";
|
|
5
|
-
const picomatch = __cjs_require("picomatch");
|
|
6
|
-
//#region \0rolldown/runtime.js
|
|
7
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
8
|
-
//#endregion
|
|
2
|
+
const picomatch = __cjs_createRequire(import.meta.url)("picomatch");
|
|
9
3
|
//#region src/utils/general.ts
|
|
10
4
|
function toArray(val, defaultValue) {
|
|
11
5
|
if (Array.isArray(val)) return val;
|
|
@@ -41,11 +35,9 @@ function pkgExists(moduleName) {
|
|
|
41
35
|
} catch {}
|
|
42
36
|
return false;
|
|
43
37
|
}
|
|
44
|
-
async function importWithError(moduleName
|
|
45
|
-
let resolved;
|
|
46
|
-
if (resolvePaths) resolved = pathToFileURL(__require.resolve(moduleName, { paths: resolvePaths })).href;
|
|
38
|
+
async function importWithError(moduleName) {
|
|
47
39
|
try {
|
|
48
|
-
return await import(
|
|
40
|
+
return await import(moduleName);
|
|
49
41
|
} catch (error) {
|
|
50
42
|
throw new Error(`Failed to import module "${moduleName}". Please ensure it is installed.`, { cause: error });
|
|
51
43
|
}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { InternalModuleFormat } from "rolldown";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/types.d.ts
|
|
4
|
+
type Overwrite<T, U> = Omit<T, keyof U> & U;
|
|
5
|
+
type Awaitable<T> = T | Promise<T>;
|
|
6
|
+
type MarkPartial<T, K extends keyof T> = Omit<Required<T>, K> & Partial<Pick<T, K>>;
|
|
7
|
+
type Arrayable<T> = T | T[];
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/utils/logger.d.ts
|
|
10
|
+
type LogType = "error" | "warn" | "info";
|
|
11
|
+
type LogLevel = LogType | "silent";
|
|
12
|
+
interface LoggerOptions {
|
|
13
|
+
allowClearScreen?: boolean;
|
|
14
|
+
customLogger?: Logger;
|
|
15
|
+
console?: Console;
|
|
16
|
+
failOnWarn?: boolean;
|
|
17
|
+
}
|
|
18
|
+
interface Logger {
|
|
19
|
+
level: LogLevel;
|
|
20
|
+
options?: LoggerOptions;
|
|
21
|
+
info: (...args: any[]) => void;
|
|
22
|
+
warn: (...args: any[]) => void;
|
|
23
|
+
warnOnce: (...args: any[]) => void;
|
|
24
|
+
error: (...args: any[]) => void;
|
|
25
|
+
success: (...args: any[]) => void;
|
|
26
|
+
clearScreen: (type: LogType) => void;
|
|
27
|
+
}
|
|
28
|
+
declare const globalLogger: Logger;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.d.mts
|
|
31
|
+
interface PackageJson {
|
|
32
|
+
/**
|
|
33
|
+
* The name is what your thing is called.
|
|
34
|
+
* Some rules:
|
|
35
|
+
* - The name must be less than or equal to 214 characters. This includes the scope for scoped packages.
|
|
36
|
+
* - The name can’t start with a dot or an underscore.
|
|
37
|
+
* - New packages must not have uppercase letters in the name.
|
|
38
|
+
* - 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.
|
|
39
|
+
*/
|
|
40
|
+
name?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Version must be parseable by `node-semver`, which is bundled with npm as a dependency. (`npm install semver` to use it yourself.)
|
|
43
|
+
*/
|
|
44
|
+
version?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Put a description in it. It’s a string. This helps people discover your package, as it’s listed in `npm search`.
|
|
47
|
+
*/
|
|
48
|
+
description?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Put keywords in it. It’s an array of strings. This helps people discover your package as it’s listed in `npm search`.
|
|
51
|
+
*/
|
|
52
|
+
keywords?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* The url to the project homepage.
|
|
55
|
+
*/
|
|
56
|
+
homepage?: string;
|
|
57
|
+
/**
|
|
58
|
+
* 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.
|
|
59
|
+
*/
|
|
60
|
+
bugs?: string | {
|
|
61
|
+
url?: string;
|
|
62
|
+
email?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 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.
|
|
66
|
+
*/
|
|
67
|
+
license?: string;
|
|
68
|
+
/**
|
|
69
|
+
* 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.
|
|
70
|
+
* For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:
|
|
71
|
+
*/
|
|
72
|
+
repository?: string | {
|
|
73
|
+
type: string;
|
|
74
|
+
url: string;
|
|
75
|
+
/**
|
|
76
|
+
* 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:
|
|
77
|
+
*/
|
|
78
|
+
directory?: string;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The `scripts` field is a dictionary containing script commands that are run at various times in the lifecycle of your package.
|
|
82
|
+
*/
|
|
83
|
+
scripts?: PackageJsonScripts;
|
|
84
|
+
/**
|
|
85
|
+
* If you set `"private": true` in your package.json, then npm will refuse to publish it.
|
|
86
|
+
*/
|
|
87
|
+
private?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* The “author” is one person.
|
|
90
|
+
*/
|
|
91
|
+
author?: PackageJsonPerson;
|
|
92
|
+
/**
|
|
93
|
+
* “contributors” is an array of people.
|
|
94
|
+
*/
|
|
95
|
+
contributors?: PackageJsonPerson[];
|
|
96
|
+
/**
|
|
97
|
+
* An object containing a URL that provides up-to-date information
|
|
98
|
+
* about ways to help fund development of your package,
|
|
99
|
+
* a string URL, or an array of objects and string URLs
|
|
100
|
+
*/
|
|
101
|
+
funding?: PackageJsonFunding | PackageJsonFunding[];
|
|
102
|
+
/**
|
|
103
|
+
* 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.
|
|
104
|
+
*/
|
|
105
|
+
files?: string[];
|
|
106
|
+
/**
|
|
107
|
+
* 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.
|
|
108
|
+
* This should be a module ID relative to the root of your package folder.
|
|
109
|
+
* For most modules, it makes the most sense to have a main script and often not much else.
|
|
110
|
+
*/
|
|
111
|
+
main?: string;
|
|
112
|
+
/**
|
|
113
|
+
* 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)
|
|
114
|
+
*/
|
|
115
|
+
browser?: string | Record<string, string | false>;
|
|
116
|
+
/**
|
|
117
|
+
* 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.
|
|
118
|
+
*/
|
|
119
|
+
unpkg?: string;
|
|
120
|
+
/**
|
|
121
|
+
* 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.
|
|
122
|
+
*/
|
|
123
|
+
bin?: string | Record<string, string>;
|
|
124
|
+
/**
|
|
125
|
+
* Specify either a single file or an array of filenames to put in place for the `man` program to find.
|
|
126
|
+
*/
|
|
127
|
+
man?: string | string[];
|
|
128
|
+
/**
|
|
129
|
+
* 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.
|
|
130
|
+
*/
|
|
131
|
+
dependencies?: Record<string, string>;
|
|
132
|
+
/**
|
|
133
|
+
* 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.
|
|
134
|
+
* In this case, it’s best to map these additional items in a `devDependencies` object.
|
|
135
|
+
*/
|
|
136
|
+
devDependencies?: Record<string, string>;
|
|
137
|
+
/**
|
|
138
|
+
* 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.
|
|
139
|
+
*/
|
|
140
|
+
optionalDependencies?: Record<string, string>;
|
|
141
|
+
/**
|
|
142
|
+
* 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.
|
|
143
|
+
*/
|
|
144
|
+
peerDependencies?: Record<string, string>;
|
|
145
|
+
/**
|
|
146
|
+
* TypeScript typings, typically ending by `.d.ts`.
|
|
147
|
+
*/
|
|
148
|
+
types?: string;
|
|
149
|
+
/**
|
|
150
|
+
* This field is synonymous with `types`.
|
|
151
|
+
*/
|
|
152
|
+
typings?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Non-Standard Node.js alternate entry-point to main.
|
|
155
|
+
* An initial implementation for supporting CJS packages (from main), and use module for ESM modules.
|
|
156
|
+
*/
|
|
157
|
+
module?: string;
|
|
158
|
+
/**
|
|
159
|
+
* Make main entry-point be loaded as an ESM module, support "export" syntax instead of "require"
|
|
160
|
+
*
|
|
161
|
+
* Docs:
|
|
162
|
+
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_package_json_type_field
|
|
163
|
+
*
|
|
164
|
+
* @default 'commonjs'
|
|
165
|
+
* @since Node.js v14
|
|
166
|
+
*/
|
|
167
|
+
type?: "module" | "commonjs";
|
|
168
|
+
/**
|
|
169
|
+
* Alternate and extensible alternative to "main" entry point.
|
|
170
|
+
*
|
|
171
|
+
* When using `{type: "module"}`, any ESM module file MUST end with `.mjs` extension.
|
|
172
|
+
*
|
|
173
|
+
* Docs:
|
|
174
|
+
* - https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_exports_sugar
|
|
175
|
+
*
|
|
176
|
+
* @since Node.js v12.7
|
|
177
|
+
*/
|
|
178
|
+
exports?: PackageJsonExports;
|
|
179
|
+
/**
|
|
180
|
+
* Docs:
|
|
181
|
+
* - https://nodejs.org/api/packages.html#imports
|
|
182
|
+
*/
|
|
183
|
+
imports?: Record<string, string | Record<string, string>>;
|
|
184
|
+
/**
|
|
185
|
+
* The field is used to define a set of sub-packages (or workspaces) within a monorepo.
|
|
186
|
+
*
|
|
187
|
+
* This field is an array of glob patterns or an object with specific configurations for managing
|
|
188
|
+
* multiple packages in a single repository.
|
|
189
|
+
*/
|
|
190
|
+
workspaces?: string[] | {
|
|
191
|
+
/**
|
|
192
|
+
* Workspace package paths. Glob patterns are supported.
|
|
193
|
+
*/
|
|
194
|
+
packages?: string[];
|
|
195
|
+
/**
|
|
196
|
+
* Packages to block from hoisting to the workspace root.
|
|
197
|
+
* Uses glob patterns to match module paths in the dependency tree.
|
|
198
|
+
*
|
|
199
|
+
* Docs:
|
|
200
|
+
* - https://classic.yarnpkg.com/blog/2018/02/15/nohoist/
|
|
201
|
+
*/
|
|
202
|
+
nohoist?: string[];
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* The field is used to specify different TypeScript declaration files for
|
|
206
|
+
* different versions of TypeScript, allowing for version-specific type definitions.
|
|
207
|
+
*/
|
|
208
|
+
typesVersions?: Record<string, Record<string, string[]>>;
|
|
209
|
+
/**
|
|
210
|
+
* You can specify which operating systems your module will run on:
|
|
211
|
+
* ```json
|
|
212
|
+
* {
|
|
213
|
+
* "os": ["darwin", "linux"]
|
|
214
|
+
* }
|
|
215
|
+
* ```
|
|
216
|
+
* You can also block instead of allowing operating systems, just prepend the blocked os with a '!':
|
|
217
|
+
* ```json
|
|
218
|
+
* {
|
|
219
|
+
* "os": ["!win32"]
|
|
220
|
+
* }
|
|
221
|
+
* ```
|
|
222
|
+
* The host operating system is determined by `process.platform`
|
|
223
|
+
* It is allowed to both block and allow an item, although there isn't any good reason to do this.
|
|
224
|
+
*/
|
|
225
|
+
os?: string[];
|
|
226
|
+
/**
|
|
227
|
+
* If your code only runs on certain cpu architectures, you can specify which ones.
|
|
228
|
+
* ```json
|
|
229
|
+
* {
|
|
230
|
+
* "cpu": ["x64", "ia32"]
|
|
231
|
+
* }
|
|
232
|
+
* ```
|
|
233
|
+
* Like the `os` option, you can also block architectures:
|
|
234
|
+
* ```json
|
|
235
|
+
* {
|
|
236
|
+
* "cpu": ["!arm", "!mips"]
|
|
237
|
+
* }
|
|
238
|
+
* ```
|
|
239
|
+
* The host architecture is determined by `process.arch`
|
|
240
|
+
*/
|
|
241
|
+
cpu?: string[];
|
|
242
|
+
/**
|
|
243
|
+
* This is a set of config values that will be used at publish-time.
|
|
244
|
+
*/
|
|
245
|
+
publishConfig?: {
|
|
246
|
+
/**
|
|
247
|
+
* The registry that will be used if the package is published.
|
|
248
|
+
*/
|
|
249
|
+
registry?: string;
|
|
250
|
+
/**
|
|
251
|
+
* The tag that will be used if the package is published.
|
|
252
|
+
*/
|
|
253
|
+
tag?: string;
|
|
254
|
+
/**
|
|
255
|
+
* The access level that will be used if the package is published.
|
|
256
|
+
*/
|
|
257
|
+
access?: "public" | "restricted";
|
|
258
|
+
/**
|
|
259
|
+
* **pnpm-only**
|
|
260
|
+
*
|
|
261
|
+
* By default, for portability reasons, no files except those listed in
|
|
262
|
+
* the bin field will be marked as executable in the resulting package
|
|
263
|
+
* archive. The executableFiles field lets you declare additional fields
|
|
264
|
+
* that must have the executable flag (+x) set even if
|
|
265
|
+
* they aren't directly accessible through the bin field.
|
|
266
|
+
*/
|
|
267
|
+
executableFiles?: string[];
|
|
268
|
+
/**
|
|
269
|
+
* **pnpm-only**
|
|
270
|
+
*
|
|
271
|
+
* You also can use the field `publishConfig.directory` to customize
|
|
272
|
+
* the published subdirectory relative to the current `package.json`.
|
|
273
|
+
*
|
|
274
|
+
* It is expected to have a modified version of the current package in
|
|
275
|
+
* the specified directory (usually using third party build tools).
|
|
276
|
+
*/
|
|
277
|
+
directory?: string;
|
|
278
|
+
/**
|
|
279
|
+
* **pnpm-only**
|
|
280
|
+
*
|
|
281
|
+
* When set to `true`, the project will be symlinked from the
|
|
282
|
+
* `publishConfig.directory` location during local development.
|
|
283
|
+
* @default true
|
|
284
|
+
*/
|
|
285
|
+
linkDirectory?: boolean;
|
|
286
|
+
} & Pick<PackageJson, "bin" | "main" | "exports" | "types" | "typings" | "module" | "browser" | "unpkg" | "typesVersions" | "os" | "cpu">;
|
|
287
|
+
/**
|
|
288
|
+
* See: https://nodejs.org/api/packages.html#packagemanager
|
|
289
|
+
* This field defines which package manager is expected to be used when working on the current project.
|
|
290
|
+
* Should be of the format: `<name>@<version>[#hash]`
|
|
291
|
+
*/
|
|
292
|
+
packageManager?: string;
|
|
293
|
+
[key: string]: any;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#pre--post-scripts
|
|
297
|
+
*/
|
|
298
|
+
type PackageJsonScriptWithPreAndPost<S extends string> = S | `${"pre" | "post"}${S}`;
|
|
299
|
+
/**
|
|
300
|
+
* See: https://docs.npmjs.com/cli/v11/using-npm/scripts#life-cycle-operation-order
|
|
301
|
+
*/
|
|
302
|
+
type PackageJsonNpmLifeCycleScripts = "dependencies" | "prepublishOnly" | PackageJsonScriptWithPreAndPost<"install" | "pack" | "prepare" | "publish" | "restart" | "start" | "stop" | "test" | "version">;
|
|
303
|
+
/**
|
|
304
|
+
* See: https://pnpm.io/scripts#lifecycle-scripts
|
|
305
|
+
*/
|
|
306
|
+
type PackageJsonPnpmLifeCycleScripts = "pnpm:devPreinstall";
|
|
307
|
+
type PackageJsonCommonScripts = "build" | "coverage" | "deploy" | "dev" | "format" | "lint" | "preview" | "release" | "typecheck" | "watch";
|
|
308
|
+
type PackageJsonScriptName = PackageJsonCommonScripts | PackageJsonNpmLifeCycleScripts | PackageJsonPnpmLifeCycleScripts | (string & {});
|
|
309
|
+
type PackageJsonScripts = { [P in PackageJsonScriptName]?: string };
|
|
310
|
+
/**
|
|
311
|
+
* 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.
|
|
312
|
+
*/
|
|
313
|
+
type PackageJsonPerson = string | {
|
|
314
|
+
name: string;
|
|
315
|
+
email?: string;
|
|
316
|
+
url?: string;
|
|
317
|
+
};
|
|
318
|
+
type PackageJsonFunding = string | {
|
|
319
|
+
url: string;
|
|
320
|
+
type?: string;
|
|
321
|
+
};
|
|
322
|
+
type PackageJsonExportKey = "." | "import" | "require" | "types" | "node" | "browser" | "default" | (string & {});
|
|
323
|
+
type PackageJsonExportsObject = { [P in PackageJsonExportKey]?: string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject> };
|
|
324
|
+
type PackageJsonExports = string | PackageJsonExportsObject | Array<string | PackageJsonExportsObject>;
|
|
325
|
+
/**
|
|
326
|
+
* Defines a PackageJson structure.
|
|
327
|
+
* @param pkg - The `package.json` content as an object. See {@link PackageJson}.
|
|
328
|
+
* @returns the same `package.json` object.
|
|
329
|
+
*/
|
|
330
|
+
//#endregion
|
|
331
|
+
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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as RolldownContext, B as TsdownBundle, C as ChunkAddonObject, D as PackageJsonWithPath, E as OutExtensionObject, F as DepsConfig, H as CopyOptions, L as NoExternalFn, M as ExeOptions, N as SeaConfig, O as PackageType, P as DevtoolsOptions, R as ResolvedDepsConfig, S as ChunkAddonFunction, T as OutExtensionFactory, U as CopyOptionsFn, V as CopyEntry, a as NormalizedFormat, b as AttwOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as TsdownHooks, k as BuildContext, 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 PublintOptions, w as OutExtensionContext, x as ChunkAddon, y as ExportsOptions, z as RolldownChunk } from "./types-
|
|
3
|
-
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-
|
|
1
|
+
import { a as Arrayable, i as globalLogger, r as Logger } from "./index-DraNj4FA.mjs";
|
|
2
|
+
import { A as RolldownContext, B as TsdownBundle, C as ChunkAddonObject, D as PackageJsonWithPath, E as OutExtensionObject, F as DepsConfig, H as CopyOptions, L as NoExternalFn, M as ExeOptions, N as SeaConfig, O as PackageType, P as DevtoolsOptions, R as ResolvedDepsConfig, S as ChunkAddonFunction, T as OutExtensionFactory, U as CopyOptionsFn, V as CopyEntry, a as NormalizedFormat, b as AttwOptions, c as TreeshakingOptions, d as UserConfig, f as UserConfigExport, g as ReportOptions, h as Workspace, i as InlineConfig, j as TsdownHooks, k as BuildContext, 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 PublintOptions, w as OutExtensionContext, x as ChunkAddon, y as ExportsOptions, z as RolldownChunk } from "./types-C7s2EXSK.mjs";
|
|
3
|
+
import { n as mergeConfig, r as resolveUserConfig, t as defineConfig } from "./config-BjpbFAQr.mjs";
|
|
4
4
|
import * as Rolldown from "rolldown";
|
|
5
5
|
|
|
6
6
|
//#region src/build.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as buildWithConfigs, t as build } from "./build-y6nUUkVJ.mjs";
|
|
2
|
+
import { r as resolveUserConfig, t as mergeConfig } from "./options-CAjSicbD.mjs";
|
|
3
|
+
import { a as globalLogger } from "./logger-uV8l1UFa.mjs";
|
|
3
4
|
import { defineConfig } from "./config.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { t as enableDebug } from "./debug-C4FmgzkJ.mjs";
|
|
5
|
+
import { t as enableDebug } from "./debug-CLlnG64L.mjs";
|
|
6
6
|
import * as Rolldown from "rolldown";
|
|
7
7
|
export { Rolldown, build, buildWithConfigs, defineConfig, enableDebug, globalLogger, mergeConfig, resolveUserConfig };
|
package/dist/internal.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as Overwrite, r as Logger, s as MarkPartial } from "./index-DraNj4FA.mjs";
|
|
2
2
|
|
|
3
|
+
//#region src/features/target.d.ts
|
|
4
|
+
declare function expandBaselineTarget(targets: string[]): string[];
|
|
5
|
+
//#endregion
|
|
3
6
|
//#region src/utils/fs.d.ts
|
|
4
7
|
declare function fsExists(path: string): Promise<boolean>;
|
|
5
8
|
declare function fsRemove(path: string): Promise<void>;
|
|
@@ -7,6 +10,6 @@ declare function fsRemove(path: string): Promise<void>;
|
|
|
7
10
|
//#region src/utils/general.d.ts
|
|
8
11
|
declare function toArray<T>(val: T | T[] | null | undefined, defaultValue?: T): T[];
|
|
9
12
|
declare function resolveComma<T extends string>(arr: T[]): T[];
|
|
10
|
-
declare function importWithError<T>(moduleName: string
|
|
13
|
+
declare function importWithError<T>(moduleName: string): Promise<T>;
|
|
11
14
|
//#endregion
|
|
12
|
-
export { type Logger, type MarkPartial, type Overwrite, fsExists, fsRemove, importWithError, resolveComma, toArray };
|
|
15
|
+
export { type Logger, type MarkPartial, type Overwrite, expandBaselineTarget, fsExists, fsRemove, importWithError, resolveComma, toArray };
|
package/dist/internal.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { n as importWithError, s as resolveComma, u as toArray } from "./general-CRszZCrY.mjs";
|
|
2
1
|
import { n as fsExists, r as fsRemove } from "./fs-Dd6Htx2P.mjs";
|
|
3
|
-
|
|
2
|
+
import { n as importWithError, s as resolveComma, u as toArray } from "./general-D3muxt2f.mjs";
|
|
3
|
+
import { t as expandBaselineTarget } from "./target-s30wya8e.mjs";
|
|
4
|
+
export { expandBaselineTarget, fsExists, fsRemove, importWithError, resolveComma, toArray };
|