unplugin-keywords 2.16.0 → 2.16.1

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.
Files changed (2) hide show
  1. package/README.md +15 -4
  2. package/package.json +1 -21
package/README.md CHANGED
@@ -86,17 +86,15 @@ const _="b";const a={a:_,c:data};
86
86
  _Convention:_ `import * as K from '~keywords';`
87
87
 
88
88
  - **`~keywords/public` (Stable Hash):**
89
- Generates deterministic, key-derived hashes (e.g., `"z2pL21k"`). Designed for **public-facing APIs** and structural contracts that must remain consistent across package boundaries (e.g., `package.json` exports).
89
+ Generates deterministic, key-derived hashes (e.g., `"z2pL21k"`). Designed for **public-facing APIs** and structural contracts that must remain consistent across package boundaries (e.g., RPC).
90
90
  _Convention:_ `import * as PK from '~keywords/public';`
91
91
 
92
- > **Note:** If you are building libraries for consumers who also use this plugin, see **Library Integration** below for a more optimal approach.
93
-
94
92
  - **`~keywords/raw` (Literal String):**
95
93
  Yields the exact, unobfuscated string literal (e.g., `"function"`, `"click"`). Ideal for standard APIs and repeating language keywords. Ensures a single memory instance of the string across your bundle.
96
94
  _Convention:_ `import * as RK from '~keywords/raw';`
97
95
 
98
96
  **Module Separation:**
99
- To minimize bundle size, identifiers can be partitioned: use `PK.*` for properties exposed to consumers, use `RK.*` for deduplicating raw strings like `typeof fn === RK.function`, and obscure all internal state and private members behind the default `K.*`.
97
+ To minimize bundle size, identifiers can be partitioned: use `PK.*` for contracts shared between packages, use `RK.*` for deduplicating raw strings like `typeof fn === RK.function`, and obscure all internal state and private members behind the default `K.*`.
100
98
 
101
99
  ## Integration
102
100
 
@@ -133,6 +131,19 @@ npx keywords
133
131
  > [!TIP]
134
132
  > During development, the plugin automatically runs a background type generation process while the bundler is running. Manual CLI execution is only necessary for pre-flight type checking (e.g., in CI) before the bundler runs.
135
133
 
134
+ When depending on a library that has `"keywordified": true` (where `import * as K from '~keywords'` remains intact), configure `paths` in your `tsconfig.json` to enable proper module resolution:
135
+
136
+ ```json
137
+ {
138
+ "compilerOptions": {
139
+ "paths": {
140
+ "~keywords": ["./node_modules/~keywords/index.d.ts"],
141
+ "~keywords/*": ["./node_modules/~keywords/*.d.ts"]
142
+ }
143
+ }
144
+ }
145
+ ```
146
+
136
147
  ## Library Integration
137
148
 
138
149
  When publishing libraries intended for consumers who also use `unplugin-keywords`, do not use the plugin during your library's build step. Instead, solely use the `keywords` CLI to generate types for development experience.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unplugin-keywords",
3
- "version": "2.16.0",
3
+ "version": "2.16.1",
4
4
  "description": "A build plugin for structural string literal minification and obfuscation.",
5
5
  "keywords": [
6
6
  "unplugin",
@@ -81,25 +81,5 @@
81
81
  "svelte": {
82
82
  "optional": true
83
83
  }
84
- },
85
- "devDependencies": {
86
- "@biomejs/biome": "^2.4.14",
87
- "@mdn/browser-compat-data": "^8.0.0",
88
- "@tsconfig/bases": "^1.0.23",
89
- "@types/node": "^25.6.0",
90
- "globals": "^17.6.0",
91
- "svelte": "^5.55.9",
92
- "tsdown": "^0.22.0",
93
- "typescript": "^6.0.3",
94
- "vitest": "^4.1.5"
95
- },
96
- "scripts": {
97
- "precheck": "pnpm --filter \"./demo/*\" typegen",
98
- "check": "tsc --build && biome check",
99
- "format": "biome check --write",
100
- "build": "tsdown",
101
- "build:demo": "pnpm --filter \"./demo/*\" build",
102
- "test": "vitest run",
103
- "test:demo": "pnpm --filter \"./demo/*\" test"
104
84
  }
105
85
  }