@zvirb/pinup-vite 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +9 -2
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -3
- package/src/index.ts +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Toms Zvirbulis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @zvirb/pinup-vite
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Pinup in your app's own Vite dev server: the canvas at /__pinup/, next to the app.
|
|
4
|
+
|
|
5
|
+
Part of [Pinup](https://github.com/tomszir/pinup#readme): a design canvas for the UI you actually
|
|
6
|
+
ship, where agents take the review comments. Start with the
|
|
7
|
+
[README](https://github.com/tomszir/pinup#readme) and
|
|
8
|
+
[installing](https://github.com/tomszir/pinup/blob/main/docs/install.md).
|
|
9
|
+
|
|
10
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Plugin } from 'vite';
|
|
2
|
+
export interface PinupViteOptions {
|
|
3
|
+
/** Where to start looking for pinup.config.ts. Default: the working directory. */
|
|
4
|
+
from?: string;
|
|
5
|
+
/** Where the canvas is served. Default `/__pinup/`. */
|
|
6
|
+
base?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Run the canvas agents on this server. Default false: starting the app shouldn't start an
|
|
9
|
+
* agent. `pinup dev` runs them either way.
|
|
10
|
+
*/
|
|
11
|
+
agents?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function pinup(options?: PinupViteOptions): Promise<Plugin[]>;
|
|
14
|
+
export default pinup;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAElC,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,wBAAsB,KAAK,CAAC,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA0B7E;AAED,eAAe,KAAK,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// `pinup()` in an app's vite.config: the canvas at /__pinup/ on the app's own dev server, with the
|
|
2
|
+
// app's framework plugin rendering the boards. Dev only: `vite build` never sees it.
|
|
3
|
+
//
|
|
4
|
+
// plugins: [react(), pinup()]
|
|
5
|
+
//
|
|
6
|
+
// It finds pinup.config.ts from Vite's root upward (the monorepo root, usually) and restarts the
|
|
7
|
+
// server when it or pinup.local.ts changes. `pinup dev` stays the way to run the canvas on its own,
|
|
8
|
+
// where nothing of the app's config can reach the UI packages.
|
|
9
|
+
import { resolve } from 'node:path';
|
|
10
|
+
import { pinup as canvas } from '@zvirb/pinup-canvas/vite';
|
|
11
|
+
import { loadConfig } from '@zvirb/pinup-core/node';
|
|
12
|
+
export async function pinup(options = {}) {
|
|
13
|
+
const loaded = await loadConfig(options.from, true);
|
|
14
|
+
// pinup.local.ts is watched even before it exists: creating one switches backends too.
|
|
15
|
+
const watched = [loaded.path, loaded.localPath ?? resolve(loaded.root, 'pinup.local.ts')];
|
|
16
|
+
return [
|
|
17
|
+
canvas({
|
|
18
|
+
config: loaded.config,
|
|
19
|
+
root: loaded.root,
|
|
20
|
+
base: options.base ?? '/__pinup/',
|
|
21
|
+
agents: options.agents ?? false,
|
|
22
|
+
hosted: true,
|
|
23
|
+
}),
|
|
24
|
+
{
|
|
25
|
+
name: 'pinup:config',
|
|
26
|
+
apply: 'serve',
|
|
27
|
+
configureServer(server) {
|
|
28
|
+
server.watcher.add(watched);
|
|
29
|
+
const restart = (path) => {
|
|
30
|
+
if (!watched.includes(path))
|
|
31
|
+
return;
|
|
32
|
+
server.config.logger.info(' pinup config changed, restarting');
|
|
33
|
+
void server.restart();
|
|
34
|
+
};
|
|
35
|
+
server.watcher.on('change', restart).on('add', restart).on('unlink', restart);
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
export default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AAI,CAAC,qCAAqC,CAAC,CAAA;oBAChE,KAAK,MAAM,CAAC,OAAO,EAAE,CAAA;gBACvB,CAAC,CAAA;gBACD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YAC/E,CAAC;SACF;KACF,CAAA;AACH,CAAC;AAED,eAAe,KAAK,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zvirb/pinup-vite",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Pinup in your app's own Vite dev server: the canvas at /__pinup/, next to the app.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/tomszir/pinup.git",
|
|
8
|
+
"directory": "packages/vite"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/tomszir/pinup#readme",
|
|
11
|
+
"bugs": "https://github.com/tomszir/pinup/issues",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"vite-plugin",
|
|
16
|
+
"design-review",
|
|
17
|
+
"canvas"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=22.18"
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"src",
|
|
31
|
+
"!src/**/*.test.ts"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@zvirb/pinup-canvas": "0.1.0",
|
|
38
|
+
"@zvirb/pinup-core": "0.1.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"vite": ">=7"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"vite": "8.3.8"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {}
|
|
6
47
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// `pinup()` in an app's vite.config: the canvas at /__pinup/ on the app's own dev server, with the
|
|
2
|
+
// app's framework plugin rendering the boards. Dev only: `vite build` never sees it.
|
|
3
|
+
//
|
|
4
|
+
// plugins: [react(), pinup()]
|
|
5
|
+
//
|
|
6
|
+
// It finds pinup.config.ts from Vite's root upward (the monorepo root, usually) and restarts the
|
|
7
|
+
// server when it or pinup.local.ts changes. `pinup dev` stays the way to run the canvas on its own,
|
|
8
|
+
// where nothing of the app's config can reach the UI packages.
|
|
9
|
+
import { resolve } from 'node:path'
|
|
10
|
+
import { pinup as canvas } from '@zvirb/pinup-canvas/vite'
|
|
11
|
+
import { loadConfig } from '@zvirb/pinup-core/node'
|
|
12
|
+
import type { Plugin } from 'vite'
|
|
13
|
+
|
|
14
|
+
export interface PinupViteOptions {
|
|
15
|
+
/** Where to start looking for pinup.config.ts. Default: the working directory. */
|
|
16
|
+
from?: string
|
|
17
|
+
/** Where the canvas is served. Default `/__pinup/`. */
|
|
18
|
+
base?: string
|
|
19
|
+
/**
|
|
20
|
+
* Run the canvas agents on this server. Default false: starting the app shouldn't start an
|
|
21
|
+
* agent. `pinup dev` runs them either way.
|
|
22
|
+
*/
|
|
23
|
+
agents?: boolean
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export async function pinup(options: PinupViteOptions = {}): Promise<Plugin[]> {
|
|
27
|
+
const loaded = await loadConfig(options.from, true)
|
|
28
|
+
// pinup.local.ts is watched even before it exists: creating one switches backends too.
|
|
29
|
+
const watched = [loaded.path, loaded.localPath ?? resolve(loaded.root, 'pinup.local.ts')]
|
|
30
|
+
return [
|
|
31
|
+
canvas({
|
|
32
|
+
config: loaded.config,
|
|
33
|
+
root: loaded.root,
|
|
34
|
+
base: options.base ?? '/__pinup/',
|
|
35
|
+
agents: options.agents ?? false,
|
|
36
|
+
hosted: true,
|
|
37
|
+
}),
|
|
38
|
+
{
|
|
39
|
+
name: 'pinup:config',
|
|
40
|
+
apply: 'serve',
|
|
41
|
+
configureServer(server) {
|
|
42
|
+
server.watcher.add(watched)
|
|
43
|
+
const restart = (path: string) => {
|
|
44
|
+
if (!watched.includes(path)) return
|
|
45
|
+
server.config.logger.info(' pinup config changed, restarting')
|
|
46
|
+
void server.restart()
|
|
47
|
+
}
|
|
48
|
+
server.watcher.on('change', restart).on('add', restart).on('unlink', restart)
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default pinup
|