rolldown-plugin-dts-snapshot 0.2.0 → 0.3.0

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
@@ -14,6 +14,21 @@ npm i rolldown-plugin-dts-snapshot
14
14
 
15
15
  ## Usage
16
16
 
17
+ ### tsdown
18
+
19
+ ```ts
20
+ import { DtsSnapshot } from 'rolldown-plugin-dts-snapshot'
21
+ import { defineConfig } from 'tsdown'
22
+
23
+ export default defineConfig({
24
+ entry: 'src/index.ts',
25
+ dts: true,
26
+ plugins: [DtsSnapshot()],
27
+ })
28
+ ```
29
+
30
+ ### Rolldown
31
+
17
32
  ```ts
18
33
  import { defineConfig } from 'rolldown'
19
34
  import { dts } from 'rolldown-plugin-dts'
@@ -25,6 +40,26 @@ export default defineConfig({
25
40
  })
26
41
  ```
27
42
 
43
+ ## Options
44
+
45
+ ```ts
46
+ export interface Options {
47
+ /**
48
+ * @default /\.d\.[cm]?ts$/
49
+ */
50
+ include?: FilterPattern
51
+ exclude?: FilterPattern
52
+ /**
53
+ * @default false
54
+ */
55
+ includeNonExport?: boolean
56
+ /**
57
+ * @default '[cwd]/dts.snapshot.json'
58
+ */
59
+ saveTo?: string
60
+ }
61
+ ```
62
+
28
63
  ## Sponsors
29
64
 
30
65
  <p align="center">
package/dist/index.d.mts CHANGED
@@ -9,9 +9,9 @@ interface Options {
9
9
  include?: FilterPattern;
10
10
  exclude?: FilterPattern;
11
11
  /**
12
- * @default true
12
+ * @default false
13
13
  */
14
- excludeNonExport?: boolean;
14
+ includeNonExport?: boolean;
15
15
  /**
16
16
  * @default '[cwd]/dts.snapshot.json'
17
17
  */
@@ -20,7 +20,7 @@ interface Options {
20
20
  declare function DtsSnapshot({
21
21
  include,
22
22
  exclude,
23
- excludeNonExport,
23
+ includeNonExport,
24
24
  saveTo
25
25
  }?: Options): Plugin;
26
26
  //#endregion
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { createFilter } from "unplugin-utils";
4
4
 
5
5
  //#region src/index.ts
6
6
  const RE_DTS = /\.d\.[cm]?ts$/;
7
- function DtsSnapshot({ include = RE_DTS, exclude, excludeNonExport = true, saveTo = "dts.snapshot.json" } = {}) {
7
+ function DtsSnapshot({ include = RE_DTS, exclude, includeNonExport = true, saveTo = "dts.snapshot.json" } = {}) {
8
8
  const filter = createFilter(include, exclude);
9
9
  return {
10
10
  name: "rolldown-plugin-dts-snapshot",
@@ -16,7 +16,7 @@ function DtsSnapshot({ include = RE_DTS, exclude, excludeNonExport = true, saveT
16
16
  if (chunk.type === "asset" || !filter(chunk.fileName)) continue;
17
17
  const map = result[chunk.preliminaryFileName] = snapshot(chunk.code, chunk.fileName, { applyExportRename: chunk.isEntry });
18
18
  if (chunk.isEntry) {
19
- if (excludeNonExport) {
19
+ if (!includeNonExport) {
20
20
  for (const key of Object.keys(map)) if (key !== "#exports" && !chunk.exports.includes(key)) delete map[key];
21
21
  }
22
22
  map["#exports"] = chunk.exports;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rolldown-plugin-dts-snapshot",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "description": "DTS snapshot plugin for Rolldown",
6
6
  "author": "Kevin Deng <sxzz@sxzz.moe>",
7
7
  "license": "MIT",
@@ -42,10 +42,10 @@
42
42
  },
43
43
  "devDependencies": {
44
44
  "@oxc-project/types": "^0.105.0",
45
- "@sxzz/eslint-config": "^7.4.3",
45
+ "@sxzz/eslint-config": "^7.4.4",
46
46
  "@sxzz/prettier-config": "^2.2.6",
47
47
  "@types/node": "^25.0.3",
48
- "@typescript/native-preview": "7.0.0-dev.20251221.1",
48
+ "@typescript/native-preview": "7.0.0-dev.20251222.1",
49
49
  "bumpp": "^10.3.2",
50
50
  "eslint": "^9.39.2",
51
51
  "prettier": "^3.7.4",