@drincs/pixi-vn 1.8.1 → 1.8.2
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/README.md +3 -47
- package/dist/{HistoryChoiceMenuOption-BP9Tsbyd.d.ts → HistoryChoiceMenuOption-CS41KG13.d.ts} +2 -2
- package/dist/{HistoryChoiceMenuOption-DSSNUXEq.d.cts → HistoryChoiceMenuOption-DdwePsOm.d.cts} +2 -2
- package/dist/{StorageElementType-DkJ394kq.d.cts → StorageElementType-C7ETezlL.d.cts} +1 -1
- package/dist/{StorageElementType-DkJ394kq.d.ts → StorageElementType-C7ETezlL.d.ts} +1 -1
- package/dist/{StoredClassModel-a4pvgJXD.d.ts → StoredClassModel-C9mQxPg-.d.cts} +9 -6
- package/dist/{StoredClassModel-LtyakzOw.d.cts → StoredClassModel-upXPNQTp.d.ts} +9 -6
- package/dist/characters.cjs +1 -1
- package/dist/characters.d.cts +54 -50
- package/dist/characters.d.ts +54 -50
- package/dist/characters.mjs +1 -1
- package/dist/chunk-K7JIC2F2.mjs +1 -0
- package/dist/{chunk-36I5IN5S.mjs → chunk-V34PMA2H.mjs} +1 -1
- package/dist/history.d.cts +2 -2
- package/dist/history.d.ts +2 -2
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +21 -6
- package/dist/index.d.ts +21 -6
- package/dist/index.mjs +2 -2
- package/dist/narration.d.cts +3 -3
- package/dist/narration.d.ts +3 -3
- package/dist/storage.cjs +1 -1
- package/dist/storage.d.cts +3 -3
- package/dist/storage.d.ts +3 -3
- package/dist/storage.mjs +1 -1
- package/dist/vite-listener.cjs +1 -1
- package/dist/vite-listener.d.cts +13 -4
- package/dist/vite-listener.d.ts +13 -4
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.cts +66 -36
- package/dist/vite.d.ts +66 -36
- package/dist/vite.mjs +1 -1
- package/package.json +14 -6
- package/dist/chunk-TTRUPDAB.mjs +0 -1
package/dist/vite.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
2
|
|
|
3
3
|
/** @const {string} API endpoint for characters data - GET to retrieve, POST to update */
|
|
4
4
|
declare const PIXIVN_DEV_API_CHARACTERS = "/__pixi-vn/characters";
|
|
@@ -10,54 +10,84 @@ declare const PIXIVN_DEV_API_ASSETS_MANIFEST = "/__pixi-vn/assets/manifest";
|
|
|
10
10
|
declare const PIXIVN_DEV_API_CANVAS_OPTIONS = "/__pixi-vn/canvas-options";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
* Defines the structure for registering middleware and handling server requests.
|
|
15
|
-
*
|
|
16
|
-
* @typedef {Object} Plugin
|
|
17
|
-
* @property {string} name - Unique identifier for the plugin
|
|
18
|
-
* @property {"serve"} apply - Plugin application scope (development server only)
|
|
19
|
-
* @property {Function} configureServer - Middleware configuration function
|
|
13
|
+
* Options for {@link vitePluginPixivn}.
|
|
20
14
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
interface VitePluginPixivnOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Glob / path of module(s) that set up all game content as side effects:
|
|
18
|
+
* characters, labels, hashtag-command handlers, text-replace handlers, etc.
|
|
19
|
+
*
|
|
20
|
+
* The plugin loads these files server-side (via Vite SSR) at startup so that
|
|
21
|
+
* every downstream plugin that depends on the registered data — most notably
|
|
22
|
+
* `vitePluginInk` for JSON compilation — has the full registry available
|
|
23
|
+
* before it runs. This also works during `vite build`.
|
|
24
|
+
*
|
|
25
|
+
* Pointing to a barrel file that re-exports everything is the simplest option.
|
|
26
|
+
* All patterns are resolved relative to Vite `root`.
|
|
27
|
+
*
|
|
28
|
+
* @example "./src/content/index.ts"
|
|
29
|
+
* @example "./src/content/*.ts"
|
|
30
|
+
*/
|
|
31
|
+
content?: string | string[];
|
|
32
|
+
/**
|
|
33
|
+
* Glob / path of module(s) whose side effects register characters via
|
|
34
|
+
* `RegisteredCharacters.add(...)`.
|
|
35
|
+
*
|
|
36
|
+
* Use when characters are defined separately from other content.
|
|
37
|
+
*
|
|
38
|
+
* @example "./src/characters.ts"
|
|
39
|
+
*/
|
|
40
|
+
characters?: string | string[];
|
|
41
|
+
/**
|
|
42
|
+
* Glob / path of module(s) whose side effects register narration labels via
|
|
43
|
+
* `RegisteredLabels.register(...)`.
|
|
44
|
+
*
|
|
45
|
+
* @example "./src/*.label.ts"
|
|
46
|
+
*/
|
|
47
|
+
labels?: string | string[];
|
|
48
|
+
}
|
|
30
49
|
/**
|
|
31
|
-
* Creates a Vite
|
|
50
|
+
* Creates a Vite plugin for Pixi'VN integration.
|
|
51
|
+
*
|
|
52
|
+
* **Static content loading**
|
|
53
|
+
*
|
|
54
|
+
* When {@link VitePluginPixivnOptions.content}, {@link VitePluginPixivnOptions.characters}, or
|
|
55
|
+
* {@link VitePluginPixivnOptions.labels} are provided, the matched files are executed server-side
|
|
56
|
+
* via Vite SSR at startup, populating `RegisteredCharacters`, `RegisteredLabels`, and any other
|
|
57
|
+
* singletons before downstream plugins (such as `vitePluginInk`) run — including during
|
|
58
|
+
* `vite build`.
|
|
32
59
|
*
|
|
33
|
-
*
|
|
34
|
-
* and the development server. Only active in development mode (serve).
|
|
60
|
+
* **Dev-server HTTP endpoints**
|
|
35
61
|
*
|
|
36
|
-
*
|
|
37
|
-
* - `
|
|
38
|
-
* - `
|
|
39
|
-
* - `
|
|
40
|
-
* - `
|
|
41
|
-
* - `
|
|
42
|
-
* - `
|
|
43
|
-
* - `
|
|
44
|
-
* - `POST /__pixi-vn/canvas-options` - Update canvas options from client
|
|
62
|
+
* - `GET /__pixi-vn/characters` — retrieve registered characters
|
|
63
|
+
* - `POST /__pixi-vn/characters` — *(deprecated)* update from client; use the `characters` option instead
|
|
64
|
+
* - `GET /__pixi-vn/labels` — retrieve narration labels
|
|
65
|
+
* - `POST /__pixi-vn/labels` — *(deprecated)* update from client; use the `labels` / `content` option instead
|
|
66
|
+
* - `GET /__pixi-vn/assets/manifest` — retrieve PIXI assets manifest
|
|
67
|
+
* - `POST /__pixi-vn/assets/manifest` — update assets manifest from client
|
|
68
|
+
* - `GET /__pixi-vn/canvas-options` — retrieve canvas rendering options
|
|
69
|
+
* - `POST /__pixi-vn/canvas-options` — update canvas options from client
|
|
45
70
|
*
|
|
46
|
-
*
|
|
71
|
+
* **Plugin API** (consumed by `vitePluginInk`):
|
|
72
|
+
* - `api.contentLoaded` — `Promise<void>` that resolves once all content modules have finished
|
|
73
|
+
* loading. Await this before generating JSON files.
|
|
47
74
|
*
|
|
48
75
|
* @example
|
|
49
76
|
* ```typescript
|
|
50
77
|
* // vite.config.ts
|
|
51
|
-
* import { defineConfig } from
|
|
52
|
-
* import { vitePluginPixivn } from
|
|
78
|
+
* import { defineConfig } from "vite";
|
|
79
|
+
* import { vitePluginPixivn } from "@drincs/pixi-vn/vite";
|
|
53
80
|
*
|
|
54
81
|
* export default defineConfig({
|
|
55
|
-
* plugins: [
|
|
82
|
+
* plugins: [
|
|
83
|
+
* vitePluginPixivn({ content: "./src/content/index.ts" }),
|
|
84
|
+
* ],
|
|
56
85
|
* });
|
|
57
86
|
* ```
|
|
58
87
|
*
|
|
59
|
-
* @
|
|
88
|
+
* @param options - Optional plugin configuration.
|
|
89
|
+
* @returns A Vite plugin.
|
|
60
90
|
*/
|
|
61
|
-
declare function vitePluginPixivn(): Plugin;
|
|
91
|
+
declare function vitePluginPixivn(options?: VitePluginPixivnOptions): Plugin;
|
|
62
92
|
|
|
63
|
-
export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, vitePluginPixivn };
|
|
93
|
+
export { PIXIVN_DEV_API_ASSETS_MANIFEST, PIXIVN_DEV_API_CANVAS_OPTIONS, PIXIVN_DEV_API_CHARACTERS, PIXIVN_DEV_API_LABELS, type VitePluginPixivnOptions, vitePluginPixivn };
|
package/dist/vite.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b,c as c$1,d
|
|
1
|
+
import {a as a$1,b,c as c$1,d}from'./chunk-3BBZHKU4.mjs';export{c as PIXIVN_DEV_API_ASSETS_MANIFEST,d as PIXIVN_DEV_API_CANVAS_OPTIONS,a as PIXIVN_DEV_API_CHARACTERS,b as PIXIVN_DEV_API_LABELS}from'./chunk-3BBZHKU4.mjs';import {a,c}from'./chunk-K7JIC2F2.mjs';import {readFileSync}from'fs';import {glob}from'tinyglobby';var E=a((H,C)=>{var f=process||{},R=f.argv||[],u=f.env||{},D=!(u.NO_COLOR||R.includes("--no-color"))&&(!!u.FORCE_COLOR||R.includes("--color")||f.platform==="win32"||(f.stdout||{}).isTTY&&u.TERM!=="dumb"||!!u.CI),k=(n,t,c=n)=>m=>{let o=""+m,i=o.indexOf(t,n.length);return ~i?n+X(o,t,c,i)+t:n+o+t},X=(n,t,c,m)=>{let o="",i=0;do o+=n.substring(i,m)+c,i=m+t.length,m=n.indexOf(t,i);while(~m);return o+n.substring(i)},B=(n=D)=>{let t=n?k:()=>String;return {isColorSupported:n,reset:t("\x1B[0m","\x1B[0m"),bold:t("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:t("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:t("\x1B[3m","\x1B[23m"),underline:t("\x1B[4m","\x1B[24m"),inverse:t("\x1B[7m","\x1B[27m"),hidden:t("\x1B[8m","\x1B[28m"),strikethrough:t("\x1B[9m","\x1B[29m"),black:t("\x1B[30m","\x1B[39m"),red:t("\x1B[31m","\x1B[39m"),green:t("\x1B[32m","\x1B[39m"),yellow:t("\x1B[33m","\x1B[39m"),blue:t("\x1B[34m","\x1B[39m"),magenta:t("\x1B[35m","\x1B[39m"),cyan:t("\x1B[36m","\x1B[39m"),white:t("\x1B[37m","\x1B[39m"),gray:t("\x1B[90m","\x1B[39m"),bgBlack:t("\x1B[40m","\x1B[49m"),bgRed:t("\x1B[41m","\x1B[49m"),bgGreen:t("\x1B[42m","\x1B[49m"),bgYellow:t("\x1B[43m","\x1B[49m"),bgBlue:t("\x1B[44m","\x1B[49m"),bgMagenta:t("\x1B[45m","\x1B[49m"),bgCyan:t("\x1B[46m","\x1B[49m"),bgWhite:t("\x1B[47m","\x1B[49m"),blackBright:t("\x1B[90m","\x1B[39m"),redBright:t("\x1B[91m","\x1B[39m"),greenBright:t("\x1B[92m","\x1B[39m"),yellowBright:t("\x1B[93m","\x1B[39m"),blueBright:t("\x1B[94m","\x1B[39m"),magentaBright:t("\x1B[95m","\x1B[39m"),cyanBright:t("\x1B[96m","\x1B[39m"),whiteBright:t("\x1B[97m","\x1B[39m"),bgBlackBright:t("\x1B[100m","\x1B[49m"),bgRedBright:t("\x1B[101m","\x1B[49m"),bgGreenBright:t("\x1B[102m","\x1B[49m"),bgYellowBright:t("\x1B[103m","\x1B[49m"),bgBlueBright:t("\x1B[104m","\x1B[49m"),bgMagentaBright:t("\x1B[105m","\x1B[49m"),bgCyanBright:t("\x1B[106m","\x1B[49m"),bgWhiteBright:t("\x1B[107m","\x1B[49m")}};C.exports=B();C.exports.createColors=B;});var w=c(E(),1);var L=w.default.cyan("(pixi-vn)");function S(n){return n?Array.isArray(n)?n:[n]:[]}function G(n){let t=[],c=[];for(let m of n)try{let o=readFileSync(m,"utf-8"),i=/newLabel\(\s*["']([^"']+)["']/g,d;for(;(d=i.exec(o))!==null;)c.push(d[1]);let g=/new\s+\w*[Cc]haracter\(\s*["']([^"']+)["']/g;for(;(d=g.exec(o))!==null;)t.push(d[1]);}catch{}return {charIds:t,labelIds:c}}function J(n){let t,c,m=new Promise(e=>{c=e;}),o=[...S(n?.content),...S(n?.characters),...S(n?.labels)],i=[],d$1=[],g=new Set,P=[];async function A(e,s=[]){try{i=(await e("@drincs/pixi-vn")).RegisteredCharacters?.values()??[];}catch{i=[];}try{d$1=(await e("@drincs/pixi-vn")).RegisteredLabels?.keys()??[];}catch{d$1=[];}if(s.length>0){let{charIds:r,labelIds:l}=G(s),h=new Set(i.map(b=>b.id)),M=new Set(d$1);for(let b of r)h.has(b)||i.push({id:b});for(let b of l)M.has(b)||d$1.push(b);}let a=i.map(r=>r.id).join(", ")||"none";t?.logger.info(`${L} ${w.default.dim(`${i.length} character(s): [${a}], ${d$1.length} label(s)`)}`,{timestamp:true});}async function _(e,s){let a=await glob(o,{cwd:s,absolute:true,onlyFiles:true}),r=[];for(let l of a){g.add(l);try{await e(l);}catch{r.push(l);}}await A(e,r),c();}async function N(e){for(let r of g)for(let l of e.moduleGraph.getModulesByFile(r)??[])e.moduleGraph.invalidateModule(l);try{(await e.ssrLoadModule("@drincs/pixi-vn/characters")).registeredCharacters?.clear?.();}catch{}let s=await glob(o,{cwd:t.root,absolute:true,onlyFiles:true}),a=[];for(let r of s){g.add(r);try{await e.ssrLoadModule(r);}catch{a.push(r);}}await A(r=>e.ssrLoadModule(r),a);for(let r of P)r();}let O={characters:null,labels:null,manifest:null,canvasOptions:null};function x(e,s){return (a,r)=>{if(r.setHeader("Content-Type","application/json"),a.method==="GET"){let l=O[e];if(l===null){r.statusCode=404,r.end(JSON.stringify({error:`${s} not initialized`}));return}r.statusCode=200,r.end(JSON.stringify(l));return}if(a.method==="POST"){let l="";a.on("data",h=>{l+=h.toString();}),a.on("end",()=>{try{O[e]=JSON.parse(l),r.statusCode=201,r.end(JSON.stringify({message:`${s} updated successfully`}));}catch{r.statusCode=400,r.end(JSON.stringify({error:`Invalid JSON format for ${s}`}));}});}}}return {name:"vite-plugin-pixi-vn",enforce:"pre",api:{contentLoaded:m,get characters(){return i},onReload(e){P.push(e);}},configResolved(e){t=e,o.length===0&&c();},async buildStart(){if(t?.command!=="build"||o.length===0)return;let{createServer:e}=await import('vite'),s=await e({root:t.root,configFile:false,server:{middlewareMode:true},appType:"custom",logLevel:"silent",optimizeDeps:{noDiscovery:true}});try{await _(a=>s.ssrLoadModule(a),t.root);}catch{c();}finally{await s.close();}},configureServer(e){o.length>0&&_(s=>e.ssrLoadModule(s),t.root).catch(()=>{c();}),e.middlewares.use(a$1,x("characters","Characters")),e.middlewares.use(b,x("labels","Labels")),e.middlewares.use(c$1,x("manifest","Manifest")),e.middlewares.use(d,x("canvasOptions","Canvas options"));},hotUpdate({file:e,server:s}){if(o.length>0&&g.has(e))return N(s).catch(a=>{t?.logger.error(`${L} Failed to reload content.`,{error:a instanceof Error?a:new Error(String(a)),timestamp:true});}),[]}}}export{J as vitePluginPixivn};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drincs/pixi-vn",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Pixi'VN is a npm package that provides various features for creating visual novels.",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -141,16 +141,23 @@
|
|
|
141
141
|
"homepage": "https://pixi-vn.web.app/",
|
|
142
142
|
"funding": "https://github.com/DRincs-Productions/pixi-vn?sponsor=1",
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@pixi/devtools": "
|
|
145
|
-
"motion": "
|
|
146
|
-
"pixi.js": "
|
|
147
|
-
"
|
|
144
|
+
"@pixi/devtools": ">=2.0.0",
|
|
145
|
+
"motion": ">=12.38.0",
|
|
146
|
+
"pixi.js": ">=8.17.0",
|
|
147
|
+
"tinyglobby": "^0.2.16",
|
|
148
|
+
"tone": ">=15.1.0"
|
|
148
149
|
},
|
|
149
150
|
"peerDependencies": {
|
|
150
151
|
"@pixi/devtools": ">=2.0.0",
|
|
151
152
|
"motion": ">=12.38.0",
|
|
152
153
|
"pixi.js": ">=8.17.0",
|
|
153
|
-
"tone": ">=15.1.0"
|
|
154
|
+
"tone": ">=15.1.0",
|
|
155
|
+
"vite": ">=5.0.0"
|
|
156
|
+
},
|
|
157
|
+
"peerDependenciesMeta": {
|
|
158
|
+
"vite": {
|
|
159
|
+
"optional": true
|
|
160
|
+
}
|
|
154
161
|
},
|
|
155
162
|
"devDependencies": {
|
|
156
163
|
"@biomejs/biome": "^2.4.12",
|
|
@@ -162,6 +169,7 @@
|
|
|
162
169
|
"lru-cache": "11.2.7",
|
|
163
170
|
"microdiff": "^1.5.0",
|
|
164
171
|
"mime-db": "^1.54.0",
|
|
172
|
+
"picocolors": "^1.1.1",
|
|
165
173
|
"ts-node": "^10.9.2",
|
|
166
174
|
"tsconfig-paths": "^4.2.0",
|
|
167
175
|
"tsup": "^8.5.1",
|
package/dist/chunk-TTRUPDAB.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var f=Object.defineProperty;var g=a=>{throw TypeError(a)};var i=(a,b,c)=>b in a?f(a,b,{enumerable:true,configurable:true,writable:true,value:c}):a[b]=c;var l=(a,b)=>{for(var c in b)f(a,c,{get:b[c],enumerable:true});};var m=(a,b,c)=>i(a,typeof b!="symbol"?b+"":b,c),e=(a,b,c)=>b.has(a)||g("Cannot "+c);var j=(a,b,c)=>(e(a,b,"read from private field"),c?c.call(a):b.get(a)),n=(a,b,c)=>b.has(a)?g("Cannot add the same private member more than once"):b instanceof WeakSet?b.add(a):b.set(a,c),k=(a,b,c,d)=>(e(a,b,"write to private field"),d?d.call(a,c):b.set(a,c),c),o=(a,b,c)=>(e(a,b,"access private method"),c);var p=(a,b,c,d)=>({set _(h){k(a,b,h,c);},get _(){return j(a,b,d)}});export{l as a,m as b,j as c,n as d,k as e,o as f,p as g};
|