@kehto/paja 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/README.md +61 -0
- package/dist/browser-host.js +5674 -0
- package/dist/browser-host.js.map +1 -0
- package/dist/chunk-BM6ROSMJ.js +635 -0
- package/dist/chunk-BM6ROSMJ.js.map +1 -0
- package/dist/cli.d.ts +41 -0
- package/dist/cli.js +314 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/options-D3xZz-aS.d.ts +181 -0
- package/package.json +71 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
2
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
3
|
+
readonly [key: string]: JsonValue;
|
|
4
|
+
};
|
|
5
|
+
type JsonRecord = Record<string, JsonValue>;
|
|
6
|
+
type PajaCapabilityDomain = 'relay' | 'outbox' | 'storage' | 'identity' | 'keys' | 'config' | 'resource' | 'theme' | 'notify' | 'media' | 'upload' | 'intent' | 'cvm' | 'inc';
|
|
7
|
+
interface PajaSimulationRawOptions {
|
|
8
|
+
readonly capabilities?: {
|
|
9
|
+
readonly domains?: Partial<Record<PajaCapabilityDomain, boolean>>;
|
|
10
|
+
};
|
|
11
|
+
readonly acl?: {
|
|
12
|
+
readonly mode?: 'allow' | 'deny';
|
|
13
|
+
};
|
|
14
|
+
readonly firewall?: {
|
|
15
|
+
readonly mode?: 'allow' | 'deny' | 'observe';
|
|
16
|
+
};
|
|
17
|
+
readonly identity?: {
|
|
18
|
+
readonly mode?: 'anonymous' | 'fixed';
|
|
19
|
+
readonly pubkey?: string;
|
|
20
|
+
};
|
|
21
|
+
readonly relay?: {
|
|
22
|
+
readonly mode?: 'memory' | 'disabled';
|
|
23
|
+
readonly urls?: readonly string[];
|
|
24
|
+
readonly fixtures?: readonly JsonRecord[];
|
|
25
|
+
};
|
|
26
|
+
readonly storage?: {
|
|
27
|
+
readonly mode?: 'local' | 'memory' | 'disabled';
|
|
28
|
+
};
|
|
29
|
+
readonly cache?: {
|
|
30
|
+
readonly mode?: 'memory' | 'disabled';
|
|
31
|
+
};
|
|
32
|
+
readonly upload?: {
|
|
33
|
+
readonly mode?: 'memory' | 'disabled';
|
|
34
|
+
readonly rail?: string;
|
|
35
|
+
};
|
|
36
|
+
readonly media?: {
|
|
37
|
+
readonly enabled?: boolean;
|
|
38
|
+
};
|
|
39
|
+
readonly notifications?: {
|
|
40
|
+
readonly enabled?: boolean;
|
|
41
|
+
readonly grant?: boolean;
|
|
42
|
+
};
|
|
43
|
+
readonly config?: {
|
|
44
|
+
readonly values?: JsonRecord;
|
|
45
|
+
};
|
|
46
|
+
readonly theme?: {
|
|
47
|
+
readonly mode?: 'dark' | 'light';
|
|
48
|
+
readonly values?: JsonRecord;
|
|
49
|
+
};
|
|
50
|
+
readonly intent?: {
|
|
51
|
+
readonly enabled?: boolean;
|
|
52
|
+
};
|
|
53
|
+
readonly cvm?: {
|
|
54
|
+
readonly enabled?: boolean;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface PajaSimulation {
|
|
58
|
+
readonly capabilities: {
|
|
59
|
+
readonly domains: Record<PajaCapabilityDomain, boolean>;
|
|
60
|
+
readonly disabledDomains: readonly PajaCapabilityDomain[];
|
|
61
|
+
};
|
|
62
|
+
readonly acl: {
|
|
63
|
+
readonly mode: 'allow' | 'deny';
|
|
64
|
+
};
|
|
65
|
+
readonly firewall: {
|
|
66
|
+
readonly mode: 'allow' | 'deny' | 'observe';
|
|
67
|
+
};
|
|
68
|
+
readonly identity: {
|
|
69
|
+
readonly mode: 'anonymous' | 'fixed';
|
|
70
|
+
readonly pubkey: string;
|
|
71
|
+
};
|
|
72
|
+
readonly relay: {
|
|
73
|
+
readonly mode: 'memory' | 'disabled';
|
|
74
|
+
readonly urls: readonly string[];
|
|
75
|
+
readonly fixtures: readonly JsonRecord[];
|
|
76
|
+
};
|
|
77
|
+
readonly storage: {
|
|
78
|
+
readonly mode: 'local' | 'memory' | 'disabled';
|
|
79
|
+
};
|
|
80
|
+
readonly cache: {
|
|
81
|
+
readonly mode: 'memory' | 'disabled';
|
|
82
|
+
};
|
|
83
|
+
readonly upload: {
|
|
84
|
+
readonly mode: 'memory' | 'disabled';
|
|
85
|
+
readonly rail: string;
|
|
86
|
+
};
|
|
87
|
+
readonly media: {
|
|
88
|
+
readonly enabled: boolean;
|
|
89
|
+
};
|
|
90
|
+
readonly notifications: {
|
|
91
|
+
readonly enabled: boolean;
|
|
92
|
+
readonly grant: boolean;
|
|
93
|
+
};
|
|
94
|
+
readonly config: {
|
|
95
|
+
readonly values: JsonRecord;
|
|
96
|
+
};
|
|
97
|
+
readonly theme: {
|
|
98
|
+
readonly mode: 'dark' | 'light';
|
|
99
|
+
readonly values: JsonRecord;
|
|
100
|
+
};
|
|
101
|
+
readonly intent: {
|
|
102
|
+
readonly enabled: boolean;
|
|
103
|
+
};
|
|
104
|
+
readonly cvm: {
|
|
105
|
+
readonly enabled: boolean;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
declare class PajaSimulationError extends Error {
|
|
109
|
+
constructor(message: string);
|
|
110
|
+
}
|
|
111
|
+
declare const PAJA_SIMULATION_DOMAINS: readonly PajaCapabilityDomain[];
|
|
112
|
+
declare function normalizePajaSimulation(raw: PajaSimulationRawOptions | undefined): PajaSimulation;
|
|
113
|
+
declare function summarizePajaSimulation(simulation: PajaSimulation): string;
|
|
114
|
+
|
|
115
|
+
type PajaCommand = {
|
|
116
|
+
readonly mode: 'argv';
|
|
117
|
+
readonly argv: readonly string[];
|
|
118
|
+
} | {
|
|
119
|
+
readonly mode: 'shell';
|
|
120
|
+
readonly command: string;
|
|
121
|
+
};
|
|
122
|
+
interface PajaRawOptions {
|
|
123
|
+
readonly targetUrl?: string;
|
|
124
|
+
readonly command?: PajaCommand;
|
|
125
|
+
readonly host?: string;
|
|
126
|
+
readonly port?: number | string;
|
|
127
|
+
readonly readyTimeoutMs?: number | string;
|
|
128
|
+
readonly configPath?: string;
|
|
129
|
+
readonly simulation?: PajaSimulationRawOptions;
|
|
130
|
+
}
|
|
131
|
+
interface PajaOptions {
|
|
132
|
+
readonly targetUrl: string;
|
|
133
|
+
readonly command?: PajaCommand;
|
|
134
|
+
readonly host: string;
|
|
135
|
+
readonly port: number;
|
|
136
|
+
readonly readyTimeoutMs: number;
|
|
137
|
+
readonly configPath?: string;
|
|
138
|
+
readonly simulation: PajaSimulation;
|
|
139
|
+
readonly mode: 'external-target' | 'managed-command';
|
|
140
|
+
}
|
|
141
|
+
interface PajaHostConfig {
|
|
142
|
+
readonly version: 1;
|
|
143
|
+
readonly window: {
|
|
144
|
+
readonly id: string;
|
|
145
|
+
readonly dTag: string;
|
|
146
|
+
readonly aggregateHash: string;
|
|
147
|
+
};
|
|
148
|
+
readonly target: {
|
|
149
|
+
readonly url: string;
|
|
150
|
+
readonly hmrStrategy: 'iframe-target-url';
|
|
151
|
+
readonly command?: PajaCommand;
|
|
152
|
+
};
|
|
153
|
+
readonly runtime: {
|
|
154
|
+
readonly host: string;
|
|
155
|
+
readonly port: number;
|
|
156
|
+
readonly readyTimeoutMs: number;
|
|
157
|
+
readonly configPath?: string;
|
|
158
|
+
readonly reloadToken: string;
|
|
159
|
+
readonly createdAt: string;
|
|
160
|
+
};
|
|
161
|
+
readonly chrome: {
|
|
162
|
+
readonly topBar: true;
|
|
163
|
+
readonly bottomBar: true;
|
|
164
|
+
readonly sidePanels: false;
|
|
165
|
+
};
|
|
166
|
+
readonly simulation: PajaSimulation;
|
|
167
|
+
}
|
|
168
|
+
declare class PajaOptionsError extends Error {
|
|
169
|
+
constructor(message: string);
|
|
170
|
+
}
|
|
171
|
+
declare const DEFAULT_PAJA_HOST = "127.0.0.1";
|
|
172
|
+
declare const DEFAULT_PAJA_PORT = 5197;
|
|
173
|
+
declare const DEFAULT_READY_TIMEOUT_MS = 30000;
|
|
174
|
+
declare const DEFAULT_PAJA_WINDOW_ID = "kehto-paja-window";
|
|
175
|
+
declare const DEFAULT_PAJA_DTAG = "dev-target";
|
|
176
|
+
declare const DEFAULT_PAJA_AGGREGATE_HASH = "paja";
|
|
177
|
+
declare function normalizePajaOptions(raw: PajaRawOptions): PajaOptions;
|
|
178
|
+
declare function createPajaHostConfig(options: PajaOptions, now?: Date): PajaHostConfig;
|
|
179
|
+
declare function formatPajaUrl(options: Pick<PajaOptions, 'host' | 'port'>): string;
|
|
180
|
+
|
|
181
|
+
export { DEFAULT_PAJA_AGGREGATE_HASH as D, type JsonPrimitive as J, type PajaRawOptions as P, type PajaHostConfig as a, DEFAULT_PAJA_DTAG as b, DEFAULT_PAJA_HOST as c, DEFAULT_PAJA_PORT as d, DEFAULT_PAJA_WINDOW_ID as e, DEFAULT_READY_TIMEOUT_MS as f, type JsonRecord as g, type JsonValue as h, PAJA_SIMULATION_DOMAINS as i, type PajaCapabilityDomain as j, type PajaCommand as k, type PajaOptions as l, PajaOptionsError as m, type PajaSimulation as n, PajaSimulationError as o, type PajaSimulationRawOptions as p, createPajaHostConfig as q, formatPajaUrl as r, normalizePajaOptions as s, normalizePajaSimulation as t, summarizePajaSimulation as u };
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kehto/paja",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Paja local authoring workshop for hosting napplets in a real Kehto iframe during development",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./cli": {
|
|
15
|
+
"types": "./dist/cli.d.ts",
|
|
16
|
+
"import": "./dist/cli.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@kehto/acl": "workspace:*",
|
|
29
|
+
"@kehto/firewall": "workspace:*",
|
|
30
|
+
"@kehto/nip": "workspace:*",
|
|
31
|
+
"@kehto/runtime": "workspace:*",
|
|
32
|
+
"@kehto/services": "workspace:*",
|
|
33
|
+
"@kehto/shell": "workspace:*",
|
|
34
|
+
"@kehto/wm": "workspace:*"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@napplet/core": ">=0.12.0 <0.14.0",
|
|
38
|
+
"@napplet/nap": ">=0.12.0 <0.14.0",
|
|
39
|
+
"nostr-tools": ">=2.23.3 <3.0.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@napplet/core": "^0.13.0",
|
|
43
|
+
"@napplet/nap": "^0.13.0",
|
|
44
|
+
"nostr-tools": "^2.23.3",
|
|
45
|
+
"tsup": "^8.5.0",
|
|
46
|
+
"typescript": "^5.9.3",
|
|
47
|
+
"vitest": "^4.1.2"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsup",
|
|
51
|
+
"type-check": "tsc --noEmit",
|
|
52
|
+
"test:unit": "cd ../.. && vitest run --config vitest.config.ts packages/paja",
|
|
53
|
+
"test": "pnpm test:unit"
|
|
54
|
+
},
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "git+https://github.com/kehto/web.git",
|
|
59
|
+
"directory": "packages/paja"
|
|
60
|
+
},
|
|
61
|
+
"keywords": [
|
|
62
|
+
"nostr",
|
|
63
|
+
"napplet",
|
|
64
|
+
"kehto",
|
|
65
|
+
"paja",
|
|
66
|
+
"workshop",
|
|
67
|
+
"development",
|
|
68
|
+
"runtime",
|
|
69
|
+
"hmr"
|
|
70
|
+
]
|
|
71
|
+
}
|