@crab-dev/wake 0.1.15 → 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 CHANGED
@@ -1,5 +1,21 @@
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
+
9
+ ## 0.1.16
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.
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.
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.
14
+ - Preserved configured Demo accent colors independently from the neutral workbench theme.
15
+ - Added a Yarn 4.16 Plug'n'Play release gate that packs all six local npm packages and verifies the Components runtime, hashed CSS link, and direct and transitive component styles.
16
+ - Preserved ESM default and re-exported bindings in minified code-split builds while retaining correct CommonJS default and namespace interop.
17
+ - Made dev-server startup wait for file-watcher registration and canonicalized project paths, eliminating missed immediate edits across Windows short/long path aliases while surfacing watcher initialization failures to API callers.
18
+
3
19
  ## 0.1.15
4
20
 
5
21
  - Preserved explicitly unset component Props, non-default Args, selected demos, and viewport state across copied URLs, refreshes, and browser navigation.
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) throw new Error(`${name} requires a value`)
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 extends BuildResult {
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
- outputDir?: undefined
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
- id: string
69
- file: string
70
- title: string
71
- description: string
72
- group: string
73
- groupOrder: number
74
- order: number
75
- slug: string
76
- status: string
77
- draft: boolean
78
- headings: Array<{ depth: number; title: string; id: string }>
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: BuildOptions): Promise<BundleResult>
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>
@@ -0,0 +1,52 @@
1
+ import type { ComponentType, Key, ReactNode } from 'react'
2
+
3
+ export { default as Alert } from '@crab-dev/rc-alert'
4
+ export { default as Button } from '@crab-dev/rc-button'
5
+ export { default as Dialog } from '@crab-dev/rc-dialog'
6
+ export { default as Drawer } from '@crab-dev/rc-drawer'
7
+ export { default as Empty } from '@crab-dev/rc-empty'
8
+ export { default as LineEdit } from '@crab-dev/rc-line-edit'
9
+ export { default as NumberEdit } from '@crab-dev/rc-number-edit'
10
+ export { default as Segmented } from '@crab-dev/rc-segmented'
11
+ export { default as Select } from '@crab-dev/rc-select'
12
+ export { default as Switch } from '@crab-dev/rc-switch'
13
+ export { default as Tag } from '@crab-dev/rc-tag'
14
+ export { default as TextEdit } from '@crab-dev/rc-text-edit'
15
+ export { default as Tooltip } from '@crab-dev/rc-tooltip'
16
+
17
+ export declare enum NodeType {
18
+ FOLDER = 0,
19
+ FILE = 1,
20
+ }
21
+
22
+ export declare enum LoadStateType {
23
+ UNLOADED = 0,
24
+ LOADING = 1,
25
+ LOADING_COMPLETED = 2,
26
+ }
27
+
28
+ export interface TreeNode {
29
+ parent: TreeNode | null
30
+ loadState: LoadStateType
31
+ type: NodeType
32
+ title: ReactNode
33
+ id: Key
34
+ disabled?: boolean
35
+ icon?: ReactNode
36
+ height?: number
37
+ priority?: number
38
+ }
39
+
40
+ export declare const Tree: ComponentType<any>
41
+
42
+ export {
43
+ Check,
44
+ Code2,
45
+ Copy,
46
+ Menu,
47
+ Monitor,
48
+ Moon,
49
+ RotateCcw,
50
+ SlidersHorizontal,
51
+ Sun,
52
+ } from 'lucide-react'
@@ -0,0 +1,53 @@
1
+ import Alert from '@crab-dev/rc-alert'
2
+ import Button from '@crab-dev/rc-button'
3
+ import Dialog from '@crab-dev/rc-dialog'
4
+ import Drawer from '@crab-dev/rc-drawer'
5
+ import Empty from '@crab-dev/rc-empty'
6
+ import LineEdit from '@crab-dev/rc-line-edit'
7
+ import NumberEdit from '@crab-dev/rc-number-edit'
8
+ import Segmented from '@crab-dev/rc-segmented'
9
+ import Select from '@crab-dev/rc-select'
10
+ import Switch from '@crab-dev/rc-switch'
11
+ import Tag from '@crab-dev/rc-tag'
12
+ import TextEdit from '@crab-dev/rc-text-edit'
13
+ import Tooltip from '@crab-dev/rc-tooltip'
14
+ import Tree, { LoadStateType, NodeType } from '@crab-dev/rc-tree'
15
+ import {
16
+ Check,
17
+ Code2,
18
+ Copy,
19
+ Menu,
20
+ Monitor,
21
+ Moon,
22
+ RotateCcw,
23
+ SlidersHorizontal,
24
+ Sun,
25
+ } from 'lucide-react'
26
+
27
+ export {
28
+ Alert,
29
+ Button,
30
+ Check,
31
+ Code2,
32
+ Copy,
33
+ Dialog,
34
+ Drawer,
35
+ Empty,
36
+ LineEdit,
37
+ LoadStateType,
38
+ Menu,
39
+ Monitor,
40
+ Moon,
41
+ NodeType,
42
+ NumberEdit,
43
+ RotateCcw,
44
+ Segmented,
45
+ Select,
46
+ SlidersHorizontal,
47
+ Sun,
48
+ Switch,
49
+ Tag,
50
+ TextEdit,
51
+ Tooltip,
52
+ Tree,
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crab-dev/wake",
3
- "version": "0.1.15",
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": {
@@ -22,6 +22,10 @@
22
22
  "import": "./experimental.mjs",
23
23
  "require": "./experimental.cjs"
24
24
  },
25
+ "./internal/components-runtime": {
26
+ "types": "./internal/components-runtime.d.ts",
27
+ "import": "./internal/components-runtime.mjs"
28
+ },
25
29
  "./package.json": "./package.json"
26
30
  },
27
31
  "bin": {
@@ -32,6 +36,7 @@
32
36
  },
33
37
  "files": [
34
38
  "bin",
39
+ "internal",
35
40
  "*.cjs",
36
41
  "*.mjs",
37
42
  "index.d.ts",
@@ -59,7 +64,7 @@
59
64
  "@crab-dev/rc-text-edit": "^0.0.1",
60
65
  "@crab-dev/rc-tooltip": "^0.0.2",
61
66
  "@crab-dev/rc-tree": "^0.1.2",
62
- "@linaria/core": "^8.1.1",
67
+ "@crab-dev/css": "0.1.17",
63
68
  "lucide-react": "^1.23.0"
64
69
  },
65
70
  "peerDependencies": {
@@ -67,11 +72,11 @@
67
72
  "react-dom": "^19.2.8"
68
73
  },
69
74
  "optionalDependencies": {
70
- "@crab-dev/wake-darwin-arm64": "0.1.15",
71
- "@crab-dev/wake-darwin-x64": "0.1.15",
72
- "@crab-dev/wake-linux-arm64-gnu": "0.1.15",
73
- "@crab-dev/wake-linux-x64-gnu": "0.1.15",
74
- "@crab-dev/wake-win32-x64-msvc": "0.1.15"
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"
75
80
  },
76
81
  "publishConfig": {
77
82
  "access": "public",