bun-plugin-stx 0.1.16 → 0.2.3
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/dist/chunk-eecw9x2f.js +4 -0
- package/dist/chunk-ymdk9x8z.js +458 -0
- package/dist/client.js +116 -1
- package/dist/index.d.ts +29 -2
- package/dist/index.js +21 -19
- package/dist/preload.js +9 -1
- package/dist/serve.d.ts +12 -0
- package/dist/serve.js +5621 -15
- package/dist/watch.d.ts +106 -0
- package/package.json +4 -4
- package/dist/chunk-h0s48z3v.js +0 -3
- package/dist/chunk-mjj2b826.js +0 -678
package/dist/watch.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { BuildConfig } from 'bun';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import type { StxOptions } from '@stacksjs/stx';
|
|
4
|
+
import type { WatchEventType } from 'node:fs';
|
|
5
|
+
/**
|
|
6
|
+
* Create a file watcher for stx templates
|
|
7
|
+
*
|
|
8
|
+
* @param options - Watch options
|
|
9
|
+
* @returns Watcher instance
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const watcher = createWatcher({
|
|
14
|
+
* paths: ['./src'],
|
|
15
|
+
* onChange: (event) => console.log('Changed:', event.path),
|
|
16
|
+
* })
|
|
17
|
+
*
|
|
18
|
+
* // Later, stop watching
|
|
19
|
+
* watcher.close()
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function createWatcher(options?: WatchOptions): WatcherInstance;
|
|
23
|
+
/**
|
|
24
|
+
* Watch files and automatically rebuild on changes
|
|
25
|
+
*
|
|
26
|
+
* @param options - Watch and build options
|
|
27
|
+
* @returns Watcher instance
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* const watcher = await watchAndBuild({
|
|
32
|
+
* entrypoints: ['./src/index.stx'],
|
|
33
|
+
* outdir: './dist',
|
|
34
|
+
* onRebuild: (result) => {
|
|
35
|
+
* if (result.success) {
|
|
36
|
+
* console.log(`Rebuilt in ${result.duration}ms`)
|
|
37
|
+
* } else {
|
|
38
|
+
* console.error('Build failed:', result.errors)
|
|
39
|
+
* }
|
|
40
|
+
* },
|
|
41
|
+
* })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function watchAndBuild(options: WatchAndBuildOptions): Promise<WatcherInstance>;
|
|
45
|
+
/**
|
|
46
|
+
* Start watch mode from CLI
|
|
47
|
+
* This is used internally by the stx CLI
|
|
48
|
+
*/
|
|
49
|
+
export declare function startWatchMode(args: {
|
|
50
|
+
entrypoints: string[]
|
|
51
|
+
outdir: string
|
|
52
|
+
verbose?: boolean
|
|
53
|
+
stxOptions?: StxOptions
|
|
54
|
+
}): Promise<WatcherInstance>;
|
|
55
|
+
/**
|
|
56
|
+
* Watch mode options
|
|
57
|
+
*/
|
|
58
|
+
export declare interface WatchOptions {
|
|
59
|
+
paths?: string[]
|
|
60
|
+
patterns?: string[]
|
|
61
|
+
extensions?: string[]
|
|
62
|
+
ignore?: string[]
|
|
63
|
+
debounce?: number
|
|
64
|
+
onChange?: (event: WatchEvent) => void
|
|
65
|
+
onError?: (error: Error) => void
|
|
66
|
+
verbose?: boolean
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Watch and build options
|
|
70
|
+
*/
|
|
71
|
+
export declare interface WatchAndBuildOptions extends WatchOptions {
|
|
72
|
+
entrypoints: string[]
|
|
73
|
+
outdir?: string
|
|
74
|
+
buildConfig?: Partial<BuildConfig>
|
|
75
|
+
stxOptions?: StxOptions
|
|
76
|
+
onRebuild?: (result: WatchBuildResult) => void
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Watch event details
|
|
80
|
+
*/
|
|
81
|
+
export declare interface WatchEvent {
|
|
82
|
+
type: WatchEventType
|
|
83
|
+
path: string
|
|
84
|
+
timestamp: number
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Watch build result
|
|
88
|
+
*/
|
|
89
|
+
export declare interface WatchBuildResult {
|
|
90
|
+
success: boolean
|
|
91
|
+
outputs?: string[]
|
|
92
|
+
errors?: Error[]
|
|
93
|
+
duration: number
|
|
94
|
+
triggeredBy: string[]
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Watcher instance
|
|
98
|
+
*/
|
|
99
|
+
export declare interface WatcherInstance {
|
|
100
|
+
close: () => void
|
|
101
|
+
getWatchedPaths: () => string[]
|
|
102
|
+
addPath: (path: string) => void
|
|
103
|
+
removePath: (path: string) => void
|
|
104
|
+
isWatching: () => boolean
|
|
105
|
+
}
|
|
106
|
+
export default createWatcher;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bun-plugin-stx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "A Bun plugin that allows for using Laravel Blade-like syntax.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
],
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "bun --bun build.ts",
|
|
58
|
-
"lint": "bunx
|
|
59
|
-
"lint:fix": "bunx
|
|
58
|
+
"lint": "bunx --bun pickier lint",
|
|
59
|
+
"lint:fix": "bunx --bun pickier lint --fix",
|
|
60
60
|
"fresh": "bunx rimraf node_modules/ bun.lock && bun i",
|
|
61
61
|
"changelog": "bunx changelogen --output CHANGELOG.md",
|
|
62
62
|
"prepublishOnly": "bun run build",
|
|
@@ -67,6 +67,6 @@
|
|
|
67
67
|
"typecheck": "bun tsc --noEmit"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@stacksjs/stx": "
|
|
70
|
+
"@stacksjs/stx": "workspace:*"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/dist/chunk-h0s48z3v.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var g=Object.create;var{getPrototypeOf:h,defineProperty:e,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var k=(a,f,b)=>{b=a!=null?g(h(a)):{};let c=f||!a||!a.__esModule?e(b,"default",{value:a,enumerable:!0}):b;for(let d of i(a))if(!j.call(c,d))e(c,d,{get:()=>a[d],enumerable:!0});return c};var l=import.meta.require;
|
|
3
|
-
export{k as h,l as i};
|