@crab-dev/wake 0.1.16 → 0.1.17
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 +20 -1
- package/bin/wake.mjs +60 -3
- package/index.d.ts +45 -17
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.17
|
|
4
|
+
|
|
5
|
+
- Added AST-driven CSS parsing shared by compilation, CSS-in-JS nesting, editor diagnostics, and semantic highlighting, removing the legacy TextMate injection grammar.
|
|
6
|
+
- Added Node library bundle APIs and CLI support with incremental rebuild coverage and updated documentation.
|
|
7
|
+
- Added complete CI release coverage for all seven public npm packages and GitHub-only multi-platform VSIX releases.
|
|
8
|
+
|
|
3
9
|
## 0.1.16
|
|
4
10
|
|
|
11
|
+
- Added Node 20 CommonJS single-file bundles with atomic exact-outfile writes, host externals, declaration-ordered Node conditional exports, usable source-map results, and matching Rust/npm CLI support.
|
|
5
12
|
- Automatically loaded Crab UI component CSS from package identity across `node_modules`, workspaces, and Yarn PnP virtual, unplugged, and zip layouts without runtime CSS imports.
|
|
6
13
|
- Added issuer-scoped Yarn PnP dependency fallbacks for Components workbenches while preserving aliases, package-owned dependency versions, exports errors, and ambiguous virtual-locator rejection.
|
|
7
14
|
- Preserved configured Demo accent colors independently from the neutral workbench theme.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ npx wake build
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import { build, startDevServer } from '@crab-dev/wake'
|
|
12
|
+
import { build, bundle, startDevServer } from '@crab-dev/wake'
|
|
13
13
|
|
|
14
14
|
await build({ cwd: process.cwd() })
|
|
15
15
|
|
|
@@ -27,6 +27,25 @@ The stable API also includes in-memory `bundle()`, incremental
|
|
|
27
27
|
and server operations accept `AbortSignal`; long-lived contexts and servers
|
|
28
28
|
support explicit close methods and JavaScript disposal protocols.
|
|
29
29
|
|
|
30
|
+
Node-hosted tools can request an exact CommonJS artifact without Web output:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
await bundle({
|
|
34
|
+
entry: 'src/extension.ts',
|
|
35
|
+
outfile: 'dist/extension.js',
|
|
36
|
+
platform: 'node',
|
|
37
|
+
format: 'cjs',
|
|
38
|
+
target: 'node20',
|
|
39
|
+
external: ['vscode'],
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`platform: 'node'` defaults to CommonJS and `node20`, so `format` and `target`
|
|
44
|
+
can be omitted. `bundle()` returns a dedicated result whose `code` is always a
|
|
45
|
+
string. With `sourceMap: true`, `sourceMap` is returned in memory; when
|
|
46
|
+
`outfile` is present Wake also writes `<outfile>.map`, exposes
|
|
47
|
+
`sourceMapFile`, and appends the matching `sourceMappingURL`.
|
|
48
|
+
|
|
30
49
|
Full documentation:
|
|
31
50
|
|
|
32
51
|
- [Node.js API](https://github.com/hotlif/wake/blob/canary/docs/reference/node-api.mdx)
|
package/bin/wake.mjs
CHANGED
|
@@ -4,9 +4,11 @@ import { readFile } from 'node:fs/promises'
|
|
|
4
4
|
import {
|
|
5
5
|
build,
|
|
6
6
|
buildDocs,
|
|
7
|
+
bundle,
|
|
7
8
|
startDevServer,
|
|
8
9
|
startDocsDevServer,
|
|
9
10
|
version,
|
|
11
|
+
WakeError,
|
|
10
12
|
} from '../index.mjs'
|
|
11
13
|
import { parse, tokenize } from '../experimental.mjs'
|
|
12
14
|
import {
|
|
@@ -32,6 +34,9 @@ const HELP = `Wake ${version()}
|
|
|
32
34
|
Usage:
|
|
33
35
|
wake [--ui auto|tui|plain] [--no-color] <command>
|
|
34
36
|
wake build [entry] [--outdir DIR] [--cache] [--sourcemap]
|
|
37
|
+
wake bundle <entry> --outfile FILE [--platform browser|node] [--format iife|cjs]
|
|
38
|
+
[--target node20] [--external PACKAGE] [--minify] [--sourcemap]
|
|
39
|
+
[--cache] [--config FILE]
|
|
35
40
|
wake dev [root] [--entry FILE] [--host HOST] [--port PORT] [--open]
|
|
36
41
|
wake docs build [root] [--mode site|components] [--outdir DIR] [--base PATH]
|
|
37
42
|
wake docs dev [root] [--mode site|components] [--host HOST] [--port PORT] [--open]
|
|
@@ -45,15 +50,24 @@ Options:
|
|
|
45
50
|
--format Human or JSON output for parse/tokenize (default: auto)
|
|
46
51
|
`
|
|
47
52
|
|
|
48
|
-
function takeOption(args, name) {
|
|
53
|
+
function takeOption(args, name, usage = false) {
|
|
49
54
|
const index = args.indexOf(name)
|
|
50
55
|
if (index === -1) return undefined
|
|
51
|
-
if (index + 1 >= args.length)
|
|
56
|
+
if (index + 1 >= args.length) {
|
|
57
|
+
const message = `${name} requires a value`
|
|
58
|
+
throw usage ? usageError(message) : new Error(message)
|
|
59
|
+
}
|
|
52
60
|
const [value] = args.splice(index + 1, 1)
|
|
53
61
|
args.splice(index, 1)
|
|
54
62
|
return value
|
|
55
63
|
}
|
|
56
64
|
|
|
65
|
+
function usageError(message) {
|
|
66
|
+
const error = new WakeError('WAKE_CONFIG', message)
|
|
67
|
+
error.exitCode = 2
|
|
68
|
+
return error
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
function takeFlag(args, name) {
|
|
58
72
|
const index = args.indexOf(name)
|
|
59
73
|
if (index === -1) return false
|
|
@@ -61,6 +75,15 @@ function takeFlag(args, name) {
|
|
|
61
75
|
return true
|
|
62
76
|
}
|
|
63
77
|
|
|
78
|
+
function takeOptions(args, name, usage = false) {
|
|
79
|
+
const values = []
|
|
80
|
+
for (;;) {
|
|
81
|
+
const value = takeOption(args, name, usage)
|
|
82
|
+
if (value === undefined) return values
|
|
83
|
+
values.push(value)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
64
87
|
function commonOptions(args) {
|
|
65
88
|
return {
|
|
66
89
|
configPath: takeOption(args, '--config'),
|
|
@@ -78,6 +101,13 @@ function validateChoice(value, name, choices) {
|
|
|
78
101
|
return value
|
|
79
102
|
}
|
|
80
103
|
|
|
104
|
+
function validateBundleChoice(value, name, choices) {
|
|
105
|
+
if (!choices.includes(value)) {
|
|
106
|
+
throw usageError(`${name} must be one of: ${choices.join(', ')}`)
|
|
107
|
+
}
|
|
108
|
+
return value
|
|
109
|
+
}
|
|
110
|
+
|
|
81
111
|
function ensureStaticMode(uiMode) {
|
|
82
112
|
if (uiMode === 'tui') {
|
|
83
113
|
throw new Error('--ui tui is only available for dev and docs dev')
|
|
@@ -245,6 +275,33 @@ export async function runCli(argv = process.argv.slice(2)) {
|
|
|
245
275
|
return 0
|
|
246
276
|
}
|
|
247
277
|
|
|
278
|
+
if (command === 'bundle') {
|
|
279
|
+
ensureStaticMode(uiMode)
|
|
280
|
+
const options = { configPath: takeOption(args, '--config', true) }
|
|
281
|
+
options.outfile = takeOption(args, '--outfile', true)
|
|
282
|
+
const platform = takeOption(args, '--platform', true)
|
|
283
|
+
if (platform !== undefined) {
|
|
284
|
+
options.platform = validateBundleChoice(platform, '--platform', ['browser', 'node'])
|
|
285
|
+
}
|
|
286
|
+
const format = takeOption(args, '--format', true)
|
|
287
|
+
if (format !== undefined) {
|
|
288
|
+
options.format = validateBundleChoice(format, '--format', ['iife', 'cjs'])
|
|
289
|
+
}
|
|
290
|
+
options.target = takeOption(args, '--target', true)
|
|
291
|
+
options.external = takeOptions(args, '--external', true)
|
|
292
|
+
options.minify = takeFlag(args, '--minify')
|
|
293
|
+
options.sourceMap = takeFlag(args, '--sourcemap')
|
|
294
|
+
options.cache = takeFlag(args, '--cache')
|
|
295
|
+
options.entry = args.shift()
|
|
296
|
+
if (!options.entry || !options.outfile) {
|
|
297
|
+
throw usageError('bundle requires one entry and --outfile FILE')
|
|
298
|
+
}
|
|
299
|
+
if (args.length) throw usageError(`unknown bundle arguments: ${args.join(' ')}`)
|
|
300
|
+
printLines(formatBanner(ui, 'bundle', version()))
|
|
301
|
+
printResult(ui, await bundle(options), 'Bundled')
|
|
302
|
+
return 0
|
|
303
|
+
}
|
|
304
|
+
|
|
248
305
|
if (command === 'dev') {
|
|
249
306
|
const options = commonOptions(args)
|
|
250
307
|
options.entry = takeOption(args, '--entry')
|
|
@@ -342,5 +399,5 @@ try {
|
|
|
342
399
|
const noColor = process.argv.includes('--no-color')
|
|
343
400
|
const ui = createUi(!noColor && supportsColor())
|
|
344
401
|
printLines(formatError(ui, error))
|
|
345
|
-
process.exitCode = 1
|
|
402
|
+
process.exitCode = error.exitCode || 1
|
|
346
403
|
}
|
package/index.d.ts
CHANGED
|
@@ -39,9 +39,25 @@ export interface BuildOptions extends ProjectOptions {
|
|
|
39
39
|
sourceMap?: boolean
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
export type BundlePlatform = 'browser' | 'node'
|
|
43
|
+
export type BundleFormat = 'iife' | 'cjs'
|
|
44
|
+
export type NodeTarget = `node${number}` | `node${number}.${number}`
|
|
45
|
+
|
|
46
|
+
export interface BundleOptions extends ProjectOptions {
|
|
47
|
+
entry?: string
|
|
48
|
+
outfile?: string
|
|
49
|
+
platform?: BundlePlatform
|
|
50
|
+
format?: BundleFormat
|
|
51
|
+
target?: NodeTarget
|
|
52
|
+
external?: string[]
|
|
53
|
+
minify?: boolean
|
|
54
|
+
sourceMap?: boolean
|
|
55
|
+
cache?: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
42
58
|
export interface OutputFile {
|
|
43
59
|
path: string
|
|
44
|
-
kind: 'chunk' | 'css' | 'asset' | 'html'
|
|
60
|
+
kind: 'chunk' | 'css' | 'asset' | 'html' | 'map'
|
|
45
61
|
bytes: number
|
|
46
62
|
}
|
|
47
63
|
|
|
@@ -57,26 +73,38 @@ export interface BuildResult {
|
|
|
57
73
|
diagnostics: Diagnostic[]
|
|
58
74
|
}
|
|
59
75
|
|
|
60
|
-
export interface BundleResult
|
|
76
|
+
export interface BundleResult {
|
|
77
|
+
success: true
|
|
78
|
+
moduleCount: number
|
|
79
|
+
updatedModuleCount: number
|
|
80
|
+
cachedModuleCount: number
|
|
81
|
+
durationMs: number
|
|
82
|
+
outputFile?: string
|
|
61
83
|
code: string
|
|
62
|
-
|
|
84
|
+
sourceMap?: string
|
|
85
|
+
sourceMapFile?: string
|
|
86
|
+
files: OutputFile[]
|
|
87
|
+
diagnostics: Diagnostic[]
|
|
63
88
|
}
|
|
64
89
|
|
|
65
90
|
export type DocsMode = 'site' | 'components'
|
|
66
91
|
|
|
67
|
-
export interface DocsRoute {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
export interface DocsRoute {
|
|
93
|
+
id: string
|
|
94
|
+
file: string
|
|
95
|
+
title: string
|
|
96
|
+
description: string
|
|
97
|
+
kind: 'overview' | 'tutorial' | 'guide' | 'reference' | 'component'
|
|
98
|
+
group: string
|
|
99
|
+
groupId: string
|
|
100
|
+
section: string
|
|
101
|
+
sectionId: string
|
|
102
|
+
slug: string
|
|
103
|
+
status: string
|
|
104
|
+
draft: boolean
|
|
105
|
+
hidden: boolean
|
|
106
|
+
headings: Array<{ depth: number; title: string; id: string }>
|
|
107
|
+
}
|
|
80
108
|
export interface DocsDemo {
|
|
81
109
|
id: string
|
|
82
110
|
title: string
|
|
@@ -146,7 +174,7 @@ export class DevServer extends EventEmitter {
|
|
|
146
174
|
}
|
|
147
175
|
|
|
148
176
|
export function version(): string
|
|
149
|
-
export function bundle(options:
|
|
177
|
+
export function bundle(options: BundleOptions): Promise<BundleResult>
|
|
150
178
|
export function build(options?: BuildOptions): Promise<BuildResult>
|
|
151
179
|
export function createBuildContext(options?: BuildOptions): Promise<BuildContext>
|
|
152
180
|
export function startDevServer(options?: DevServerOptions): Promise<DevServer>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crab-dev/wake",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
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
|
-
"@
|
|
67
|
+
"@crab-dev/css": "0.1.17",
|
|
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.17",
|
|
76
|
+
"@crab-dev/wake-darwin-x64": "0.1.17",
|
|
77
|
+
"@crab-dev/wake-linux-arm64-gnu": "0.1.17",
|
|
78
|
+
"@crab-dev/wake-linux-x64-gnu": "0.1.17",
|
|
79
|
+
"@crab-dev/wake-win32-x64-msvc": "0.1.17"
|
|
80
80
|
},
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public",
|