@crab-dev/wake 0.1.17 → 0.1.18
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/CHANGELOG.md +7 -0
- package/README.md +21 -1
- package/bin/terminal.mjs +10 -0
- package/bin/wake.mjs +26 -0
- package/index.cjs +18 -0
- package/index.d.ts +60 -1
- package/index.mjs +3 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.18
|
|
4
|
+
|
|
5
|
+
- Added native component-library ESM, CommonJS, declaration, and extracted CSS builds through `wake library build` and `buildLibrary()` without changing application builds.
|
|
6
|
+
- Added strict Rust-native token and docgen generators through `wake library token`, `wake library docgen`, `generateCssToken()`, and `generateDocgen()`.
|
|
7
|
+
- Added `defineTokens()` to `@crab-dev/css` for deeply immutable design tokens that can be safely evaluated across module boundaries.
|
|
8
|
+
- Added stable package-prefixed CSS class names, PnP-aware static analysis, transactional library outputs, and fail-closed public type diagnostics.
|
|
9
|
+
|
|
3
10
|
## 0.1.17
|
|
4
11
|
|
|
5
12
|
- Added AST-driven CSS parsing shared by compilation, CSS-in-JS nesting, editor diagnostics, and semantic highlighting, removing the legacy TextMate injection grammar.
|
package/README.md
CHANGED
|
@@ -9,9 +9,13 @@ npx wake build
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { build, bundle, startDevServer } from '@crab-dev/wake'
|
|
12
|
+
import { build, buildLibrary, bundle, generateCssToken, generateDocgen, startDevServer } from '@crab-dev/wake'
|
|
13
13
|
|
|
14
14
|
await build({ cwd: process.cwd() })
|
|
15
|
+
await buildLibrary({ cwd: process.cwd(), entry: 'src/index.ts' })
|
|
16
|
+
|
|
17
|
+
await generateCssToken({ cwd: process.cwd(), configPath: 'token.toml' })
|
|
18
|
+
await generateDocgen({ cwd: process.cwd(), entry: 'src/button.tsx' })
|
|
15
19
|
|
|
16
20
|
const server = await startDevServer({ port: 5173 })
|
|
17
21
|
console.log(server.url)
|
|
@@ -46,6 +50,22 @@ string. With `sourceMap: true`, `sourceMap` is returned in memory; when
|
|
|
46
50
|
`outfile` is present Wake also writes `<outfile>.map`, exposes
|
|
47
51
|
`sourceMapFile`, and appends the matching `sourceMappingURL`.
|
|
48
52
|
|
|
53
|
+
Component packages can generate design-token TypeScript without a Node-based
|
|
54
|
+
generator by running `wake library token` or calling `generateCssToken()`. The
|
|
55
|
+
generator supports recursive package imports in Yarn PnP and `node_modules`,
|
|
56
|
+
rejects missing references and cycles, and atomically writes only the output
|
|
57
|
+
declared by `build.output`.
|
|
58
|
+
|
|
59
|
+
`wake library build` and `buildLibrary()` emit `esm/index.mjs`,
|
|
60
|
+
`cjs/index.cjs`, `declarations/index.d.ts`, and optional `css/index.css` from
|
|
61
|
+
the native library graph. Outputs are staged and committed together; unsafe
|
|
62
|
+
public type inference or static-style failures preserve the previous build.
|
|
63
|
+
|
|
64
|
+
Component API metadata can be generated without `react-docgen` by running
|
|
65
|
+
`wake library docgen` or calling `generateDocgen()`. Entry resolution follows
|
|
66
|
+
the CLI override, package configuration, then the default export from
|
|
67
|
+
`src/index.ts`; failures leave the previous `public/docgen.json` untouched.
|
|
68
|
+
|
|
49
69
|
Full documentation:
|
|
50
70
|
|
|
51
71
|
- [Node.js API](https://github.com/hotlif/wake/blob/canary/docs/reference/node-api.mdx)
|
package/bin/terminal.mjs
CHANGED
|
@@ -87,6 +87,16 @@ export function formatBuildResult(ui, result, label = 'Built', extra = '') {
|
|
|
87
87
|
return lines
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
export function formatGeneratorResult(ui, result, label) {
|
|
91
|
+
const bytes = (result.files || []).reduce((sum, file) => sum + Number(file.bytes || 0), 0)
|
|
92
|
+
return [
|
|
93
|
+
` ${ui.ok('✓')} ${ui.bold(label)} ${ui.accent(`in ${humanDuration(result.durationMs)}`)}`,
|
|
94
|
+
` ${(result.files || []).length} ${ui.dim('files')} ${ui.dim('·')} ${ui.accent(humanBytes(bytes))}`,
|
|
95
|
+
` ${ui.dim('Output')} ${ui.accent(result.outputFile)}`,
|
|
96
|
+
'',
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
|
|
90
100
|
export function formatServerReady(ui, url, metrics) {
|
|
91
101
|
const lines = [
|
|
92
102
|
` ${ui.ok('✓')} ${ui.bold('Development server ready')}`,
|
package/bin/wake.mjs
CHANGED
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
import { readFile } from 'node:fs/promises'
|
|
4
4
|
import {
|
|
5
5
|
build,
|
|
6
|
+
buildLibrary,
|
|
6
7
|
buildDocs,
|
|
7
8
|
bundle,
|
|
9
|
+
generateCssToken,
|
|
10
|
+
generateDocgen,
|
|
8
11
|
startDevServer,
|
|
9
12
|
startDocsDevServer,
|
|
10
13
|
version,
|
|
@@ -20,6 +23,7 @@ import {
|
|
|
20
23
|
formatBuildResult,
|
|
21
24
|
formatError,
|
|
22
25
|
formatFinalSummary,
|
|
26
|
+
formatGeneratorResult,
|
|
23
27
|
formatServerReady,
|
|
24
28
|
observeServer,
|
|
25
29
|
setDashboardEndpoint,
|
|
@@ -37,6 +41,7 @@ Usage:
|
|
|
37
41
|
wake bundle <entry> --outfile FILE [--platform browser|node] [--format iife|cjs]
|
|
38
42
|
[--target node20] [--external PACKAGE] [--minify] [--sourcemap]
|
|
39
43
|
[--cache] [--config FILE]
|
|
44
|
+
wake library token [project] [--config token.toml]
|
|
40
45
|
wake dev [root] [--entry FILE] [--host HOST] [--port PORT] [--open]
|
|
41
46
|
wake docs build [root] [--mode site|components] [--outdir DIR] [--base PATH]
|
|
42
47
|
wake docs dev [root] [--mode site|components] [--host HOST] [--port PORT] [--open]
|
|
@@ -302,6 +307,27 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
302
307
|
return 0
|
|
303
308
|
}
|
|
304
309
|
|
|
310
|
+
if (command === 'library') {
|
|
311
|
+
ensureStaticMode(uiMode)
|
|
312
|
+
const action = args.shift()
|
|
313
|
+
if (action !== 'build' && action !== 'token' && action !== 'docgen') {
|
|
314
|
+
throw usageError('library requires build, token, or docgen')
|
|
315
|
+
}
|
|
316
|
+
const options = action === 'token'
|
|
317
|
+
? { configPath: takeOption(args, '--config', true) }
|
|
318
|
+
: { entry: takeOption(args, '--entry', true) }
|
|
319
|
+
if (args[0]) options.cwd = args.shift()
|
|
320
|
+
if (args.length) throw usageError(`unknown library ${action} arguments: ${args.join(' ')}`)
|
|
321
|
+
printLines(formatBanner(ui, `library ${action}`, version()))
|
|
322
|
+
if (action === 'build') {
|
|
323
|
+
printResult(ui, await buildLibrary(options), 'Built library')
|
|
324
|
+
return 0
|
|
325
|
+
}
|
|
326
|
+
const result = action === 'token' ? await generateCssToken(options) : await generateDocgen(options)
|
|
327
|
+
printLines(formatGeneratorResult(ui, result, action === 'token' ? 'Tokens generated' : 'Docgen generated'))
|
|
328
|
+
return 0
|
|
329
|
+
}
|
|
330
|
+
|
|
305
331
|
if (command === 'dev') {
|
|
306
332
|
const options = commonOptions(args)
|
|
307
333
|
options.entry = takeOption(args, '--entry')
|
package/index.cjs
CHANGED
|
@@ -25,6 +25,21 @@ async function bundle(options) {
|
|
|
25
25
|
return invoke(native.bundle(JSON.stringify(value), signal))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
async function buildLibrary(options) {
|
|
29
|
+
const [value, signal] = splitOptions(options)
|
|
30
|
+
return invoke(native.buildLibrary(JSON.stringify(value), signal))
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async function generateCssToken(options) {
|
|
34
|
+
const [value, signal] = splitOptions(options)
|
|
35
|
+
return invoke(native.generateCssToken(JSON.stringify(value), signal))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function generateDocgen(options) {
|
|
39
|
+
const [value, signal] = splitOptions(options)
|
|
40
|
+
return invoke(native.generateDocgen(JSON.stringify(value), signal))
|
|
41
|
+
}
|
|
42
|
+
|
|
28
43
|
class BuildContext {
|
|
29
44
|
#native
|
|
30
45
|
#closed = false
|
|
@@ -197,8 +212,11 @@ module.exports = {
|
|
|
197
212
|
DevServer,
|
|
198
213
|
WakeError,
|
|
199
214
|
build,
|
|
215
|
+
buildLibrary,
|
|
200
216
|
buildDocs,
|
|
201
217
|
bundle,
|
|
218
|
+
generateCssToken,
|
|
219
|
+
generateDocgen,
|
|
202
220
|
createBuildContext,
|
|
203
221
|
startDevServer,
|
|
204
222
|
startDocsDevServer,
|
package/index.d.ts
CHANGED
|
@@ -8,6 +8,18 @@ export type WakeErrorCode =
|
|
|
8
8
|
| 'WAKE_CANCELLED'
|
|
9
9
|
| 'WAKE_UNSUPPORTED_PLATFORM'
|
|
10
10
|
| 'WAKE_INTERNAL'
|
|
11
|
+
| 'WAKE_TOKEN_IO'
|
|
12
|
+
| 'WAKE_TOKEN_CONFIG'
|
|
13
|
+
| 'WAKE_TOKEN_IMPORT'
|
|
14
|
+
| 'WAKE_TOKEN_CYCLE'
|
|
15
|
+
| 'WAKE_TOKEN_REF'
|
|
16
|
+
| 'WAKE_DOCGEN_IO'
|
|
17
|
+
| 'WAKE_DOCGEN_CONFIG'
|
|
18
|
+
| 'WAKE_DOCGEN_ENTRY'
|
|
19
|
+
| 'WAKE_DOCGEN_TYPE'
|
|
20
|
+
| 'WAKE_LIBRARY_BUILD'
|
|
21
|
+
| 'WAKE_LIBRARY_TYPE'
|
|
22
|
+
| 'WAKE_LIBRARY_OUTPUT'
|
|
11
23
|
|
|
12
24
|
export interface Diagnostic {
|
|
13
25
|
severity: 'error' | 'warning' | 'note' | 'help'
|
|
@@ -57,7 +69,7 @@ export interface BundleOptions extends ProjectOptions {
|
|
|
57
69
|
|
|
58
70
|
export interface OutputFile {
|
|
59
71
|
path: string
|
|
60
|
-
kind: 'chunk' | 'css' | 'asset' | 'html' | 'map'
|
|
72
|
+
kind: 'entry' | 'chunk' | 'css' | 'declaration' | 'asset' | 'html' | 'map'
|
|
61
73
|
bytes: number
|
|
62
74
|
}
|
|
63
75
|
|
|
@@ -87,6 +99,47 @@ export interface BundleResult {
|
|
|
87
99
|
diagnostics: Diagnostic[]
|
|
88
100
|
}
|
|
89
101
|
|
|
102
|
+
export interface LibraryBuildOptions {
|
|
103
|
+
cwd?: string
|
|
104
|
+
entry?: string
|
|
105
|
+
signal?: AbortSignal
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface LibraryBuildResult extends BuildResult {
|
|
109
|
+
outputDir: string
|
|
110
|
+
esmEntry: string
|
|
111
|
+
cjsEntry: string
|
|
112
|
+
declarationEntry: string
|
|
113
|
+
cssEntry?: string
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface GenerateCssTokenOptions {
|
|
117
|
+
cwd?: string
|
|
118
|
+
configPath?: string
|
|
119
|
+
signal?: AbortSignal
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface GenerateCssTokenResult {
|
|
123
|
+
success: true
|
|
124
|
+
durationMs: number
|
|
125
|
+
outputFile: string
|
|
126
|
+
files: OutputFile[]
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface GenerateDocgenOptions {
|
|
130
|
+
cwd?: string
|
|
131
|
+
entry?: string
|
|
132
|
+
signal?: AbortSignal
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface GenerateDocgenResult {
|
|
136
|
+
success: true
|
|
137
|
+
durationMs: number
|
|
138
|
+
entry: string
|
|
139
|
+
outputFile: string
|
|
140
|
+
files: OutputFile[]
|
|
141
|
+
}
|
|
142
|
+
|
|
90
143
|
export type DocsMode = 'site' | 'components'
|
|
91
144
|
|
|
92
145
|
export interface DocsRoute {
|
|
@@ -176,6 +229,9 @@ export class DevServer extends EventEmitter {
|
|
|
176
229
|
export function version(): string
|
|
177
230
|
export function bundle(options: BundleOptions): Promise<BundleResult>
|
|
178
231
|
export function build(options?: BuildOptions): Promise<BuildResult>
|
|
232
|
+
export function buildLibrary(options?: LibraryBuildOptions): Promise<LibraryBuildResult>
|
|
233
|
+
export function generateCssToken(options?: GenerateCssTokenOptions): Promise<GenerateCssTokenResult>
|
|
234
|
+
export function generateDocgen(options?: GenerateDocgenOptions): Promise<GenerateDocgenResult>
|
|
179
235
|
export function createBuildContext(options?: BuildOptions): Promise<BuildContext>
|
|
180
236
|
export function startDevServer(options?: DevServerOptions): Promise<DevServer>
|
|
181
237
|
export function buildDocs(options?: DocsBuildOptions): Promise<DocsBuildResult>
|
|
@@ -186,8 +242,11 @@ declare const wake: {
|
|
|
186
242
|
DevServer: typeof DevServer
|
|
187
243
|
WakeError: typeof WakeError
|
|
188
244
|
build: typeof build
|
|
245
|
+
buildLibrary: typeof buildLibrary
|
|
189
246
|
buildDocs: typeof buildDocs
|
|
190
247
|
bundle: typeof bundle
|
|
248
|
+
generateCssToken: typeof generateCssToken
|
|
249
|
+
generateDocgen: typeof generateDocgen
|
|
191
250
|
createBuildContext: typeof createBuildContext
|
|
192
251
|
startDevServer: typeof startDevServer
|
|
193
252
|
startDocsDevServer: typeof startDocsDevServer
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crab-dev/wake",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Wake native web build tools for Node.js",
|
|
5
5
|
"license": "MIT OR Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@crab-dev/rc-text-edit": "^0.0.1",
|
|
65
65
|
"@crab-dev/rc-tooltip": "^0.0.2",
|
|
66
66
|
"@crab-dev/rc-tree": "^0.1.2",
|
|
67
|
-
"@crab-dev/css": "0.1.
|
|
67
|
+
"@crab-dev/css": "0.1.18",
|
|
68
68
|
"lucide-react": "^1.23.0"
|
|
69
69
|
},
|
|
70
70
|
"peerDependencies": {
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
"react-dom": "^19.2.8"
|
|
73
73
|
},
|
|
74
74
|
"optionalDependencies": {
|
|
75
|
-
"@crab-dev/wake-darwin-arm64": "0.1.
|
|
76
|
-
"@crab-dev/wake-darwin-x64": "0.1.
|
|
77
|
-
"@crab-dev/wake-linux-arm64-gnu": "0.1.
|
|
78
|
-
"@crab-dev/wake-linux-x64-gnu": "0.1.
|
|
79
|
-
"@crab-dev/wake-win32-x64-msvc": "0.1.
|
|
75
|
+
"@crab-dev/wake-darwin-arm64": "0.1.18",
|
|
76
|
+
"@crab-dev/wake-darwin-x64": "0.1.18",
|
|
77
|
+
"@crab-dev/wake-linux-arm64-gnu": "0.1.18",
|
|
78
|
+
"@crab-dev/wake-linux-x64-gnu": "0.1.18",
|
|
79
|
+
"@crab-dev/wake-win32-x64-msvc": "0.1.18"
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public",
|