@theholocron/tsdown-config 8.9.0-alpha.1 → 8.9.0-alpha.15

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/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ <!-- alex disable failed -->
2
+
1
3
  # tsdown Config
2
4
 
3
5
  Shared [tsdown](https://tsdown.dev) configurations for `@theholocron` packages.
@@ -14,7 +16,9 @@ pnpm add -D @theholocron/tsdown-config tsdown
14
16
 
15
17
  Single entry point (`src/index.ts`), generates `.d.ts` type declarations, does not bundle `@theholocron/*` peers.
16
18
 
17
- After every successful build it also fails if an emitted `.js`/`.mjs`/`.cjs` file in `outDir` is over 500KB. That is the symptom of a dependency that failed to externalize (`deps.neverBundle` misconfigured, or a tsdown/rolldown regression), which inlines the whole tree ([holocron#762](https://github.com/theholocron/holocron/issues/762)). A caller's own `onSuccess` still runs, after the check.
19
+ After every successful build it also fails if an emitted `.js`/`.mjs`/`.cjs` file in `outDir` is over 512KB. That is the symptom of a dependency that failed to externalize (`deps.neverBundle` misconfigured, or a tsdown/rolldown regression), which inlines the whole tree ([holocron#762](https://github.com/theholocron/holocron/issues/762)). A caller's own `onSuccess` still runs, after the check.
20
+
21
+ A package that inlines other code on purpose passes its own limit as the second argument, `library(options, { maxBundleBytes })`: set it a little above the package's real size, so the check still catches a dependency inlined by mistake (that adds megabytes) without failing every feature the package grows by. `apps/sentinel`, which inlines three workspace packages, does.
18
22
 
19
23
  ```ts
20
24
  // tsdown.config.ts
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { cli } from "./presets/cli.js";
2
- import { library } from "./presets/library.js";
2
+ import { t as library } from "./library-CMLscQzp.js";
3
3
  export { cli, library };
@@ -51,10 +51,14 @@ function checkBundleSize(outDir, maxBytes = MAX_BUNDLE_BYTES) {
51
51
  * externalized build).
52
52
  *
53
53
  * After every successful build, `onSuccess` fails it if an emitted bundle is
54
- * over 500KB -- the symptom of a dependency that failed to externalize
54
+ * over 512KB -- the symptom of a dependency that failed to externalize
55
55
  * (holocron#762). A caller's own `onSuccess` (function or shell command) runs after the check.
56
+ *
57
+ * A package that inlines other code on purpose (`apps/sentinel` inlines three workspace packages, holocron#922)
58
+ * raises its own limit with `maxBundleBytes`, set a little above its real size so the check still catches an
59
+ * accidental inline (a dependency adds megabytes) without failing every feature the package grows by.
56
60
  */
57
- function library(options = {}) {
61
+ function library(options = {}, limits = {}) {
58
62
  const merged = {
59
63
  entry: ["src/index.ts"],
60
64
  outDir: "dist",
@@ -70,7 +74,7 @@ function library(options = {}) {
70
74
  entry: resolveEntry(merged.entry),
71
75
  outDir: resolveOutDir(merged.outDir ?? "dist"),
72
76
  onSuccess: async (config, signal) => {
73
- checkBundleSize(config.outDir);
77
+ checkBundleSize(config.outDir, limits.maxBundleBytes);
74
78
  if (typeof userOnSuccess === "function") await userOnSuccess(config, signal);
75
79
  else if (userOnSuccess) execSync(userOnSuccess, { stdio: "inherit" });
76
80
  }
@@ -5,5 +5,6 @@ import { UserConfig } from "tsdown";
5
5
  * No type declarations — binaries don't need them.
6
6
  */
7
7
  export declare function cli(options?: UserConfig): UserConfig;
8
+ /** The CLI preset with its defaults, for a package that needs no options. */
8
9
  declare const _default: UserConfig;
9
10
  export { _default as default };
@@ -23,5 +23,6 @@ function cli(options = {}) {
23
23
  outDir: resolveOutDir(merged.outDir ?? "dist")
24
24
  });
25
25
  }
26
+ /** The CLI preset with its defaults, for a package that needs no options. */
26
27
  var cli_default = cli();
27
28
  export { cli, cli_default as default };
@@ -12,8 +12,18 @@ import { UserConfig } from "tsdown";
12
12
  * before final emit -- fragile (a future import could reach code that
13
13
  * doesn't shake away) and slow (~15s vs sub-second for a properly
14
14
  * externalized build).
15
+ *
16
+ * After every successful build, `onSuccess` fails it if an emitted bundle is
17
+ * over 512KB -- the symptom of a dependency that failed to externalize
18
+ * (holocron#762). A caller's own `onSuccess` (function or shell command) runs after the check.
19
+ *
20
+ * A package that inlines other code on purpose (`apps/sentinel` inlines three workspace packages, holocron#922)
21
+ * raises its own limit with `maxBundleBytes`, set a little above its real size so the check still catches an
22
+ * accidental inline (a dependency adds megabytes) without failing every feature the package grows by.
15
23
  */
16
- export declare function library(options?: UserConfig): UserConfig;
24
+ export declare function library(options?: UserConfig, limits?: {
25
+ maxBundleBytes?: number;
26
+ }): UserConfig;
17
27
  /** Ready-to-use config for packages that need no customisation. */
18
28
  declare const _default: UserConfig;
19
29
  export { _default as default };
@@ -1,36 +1 @@
1
- import { n as resolveOutDir, t as resolveEntry } from "../resolve-entry-DJ2WMho2.js";
2
- import { defineConfig } from "tsdown";
3
- // presets/library.ts
4
- /**
5
- * tsdown preset for a published ESM library.
6
- * Single entry point, generates types, externalizes every dependency.
7
- *
8
- * `neverBundle: true` externalizes every bare-specifier import, not just
9
- * `@theholocron/*` peers -- the narrower regex this used to carry only
10
- * ever protected org packages, so a package with real third-party runtime
11
- * deps (e.g. google-client's googleapis/google-auth-library) got them
12
- * bundled by default. Confirmed harmless there today only because
13
- * rolldown's tree-shaking happened to strip the unreachable code back out
14
- * before final emit -- fragile (a future import could reach code that
15
- * doesn't shake away) and slow (~15s vs sub-second for a properly
16
- * externalized build).
17
- */
18
- function library(options = {}) {
19
- const merged = {
20
- entry: ["src/index.ts"],
21
- outDir: "dist",
22
- format: "esm",
23
- dts: true,
24
- clean: true,
25
- deps: { neverBundle: true },
26
- ...options
27
- };
28
- return defineConfig({
29
- ...merged,
30
- entry: resolveEntry(merged.entry),
31
- outDir: resolveOutDir(merged.outDir ?? "dist")
32
- });
33
- }
34
- /** Ready-to-use config for packages that need no customisation. */
35
- var library_default = library();
36
- export { library_default as default, library };
1
+ export { n as default, t as library } from "../library-CMLscQzp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/tsdown-config",
3
- "version": "8.9.0-alpha.1",
3
+ "version": "8.9.0-alpha.15",
4
4
  "description": "Shared tsdown configurations for @theholocron packages.",
5
5
  "keywords": [
6
6
  "tsdown",
@@ -42,12 +42,12 @@
42
42
  "dist/"
43
43
  ],
44
44
  "devDependencies": {
45
- "@vitest/coverage-v8": "^5.0.5",
46
- "tsdown": "^0.23.3",
45
+ "@vitest/coverage-v8": "^5.1.0",
46
+ "tsdown": "^0.23.5",
47
47
  "typescript": "^5.9.3",
48
- "vitest": "^5.0.5",
49
- "@theholocron/tsconfig": "8.9.0-alpha.1",
50
- "@theholocron/vitest-config": "8.9.0-alpha.1"
48
+ "vitest": "^5.1.0",
49
+ "@theholocron/tsconfig": "8.9.0-alpha.15",
50
+ "@theholocron/vitest-config": "8.9.0-alpha.15"
51
51
  },
52
52
  "peerDependencies": {
53
53
  "tsdown": "^0"
@@ -59,10 +59,10 @@
59
59
  "access": "public"
60
60
  },
61
61
  "scripts": {
62
- "delivery.build": "tsdown",
63
- "sourceQuality.staticAnalysis": "eslint .",
62
+ "build": "tsdown",
63
+ "lint:code": "eslint .",
64
+ "test:unit": "vitest run --coverage",
64
65
  "test:watch": "vitest",
65
- "verification.typeSafety": "tsc --noEmit",
66
- "verification.unitTests": "vitest run"
66
+ "typecheck": "tsc --noEmit"
67
67
  }
68
68
  }