@oxprotocol/cli 0.1.5 → 0.1.7
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 +189 -0
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +7 -0
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +84 -8
- package/dist/commands/dev.js.map +1 -1
- package/package.json +13 -13
- package/templates/hello-html/.oxpignore +17 -0
- package/templates/hello-html/README.md +29 -7
- package/templates/hello-html/build.mjs +95 -0
- package/templates/hello-html/oxp.json +3 -2
- package/templates/hello-html/package.json +21 -0
- package/templates/hello-html/src/App.tsx +54 -0
- package/templates/hello-html/src/main.tsx +7 -0
- package/templates/hello-html/src/styles.css +146 -0
- package/templates/hello-html/tsconfig.json +21 -0
- package/templates/hello-html/ui/index.html +0 -43
package/LICENSE
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of tracking or improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may accept and offer support, warranty,
|
|
167
|
+
indemnity, or other liability obligations consistent with this
|
|
168
|
+
License. However, in accepting such obligations, You may act only
|
|
169
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
170
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
171
|
+
defend, and hold each Contributor harmless for any liability
|
|
172
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
173
|
+
of your accepting any such warranty or support.
|
|
174
|
+
|
|
175
|
+
END OF TERMS AND CONDITIONS
|
|
176
|
+
|
|
177
|
+
Copyright 2025 OXP contributors
|
|
178
|
+
|
|
179
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
180
|
+
you may not use this file except in compliance with the License.
|
|
181
|
+
You may obtain a copy of the License at
|
|
182
|
+
|
|
183
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
184
|
+
|
|
185
|
+
Unless required by applicable law or agreed to in writing, software
|
|
186
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
187
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
188
|
+
implied. See the License for the specific language governing permissions
|
|
189
|
+
and limitations under the License.
|
package/dist/cli.js
CHANGED
|
@@ -43,7 +43,8 @@ const HELP = `oxp ${VERSION} — Open eXtensions Protocol
|
|
|
43
43
|
|
|
44
44
|
Usage:
|
|
45
45
|
oxp create [-t TPL] <name> Scaffold a new extension in ./<name>
|
|
46
|
-
Templates: hello-html (default),
|
|
46
|
+
Templates: hello-html (React+TS, default),
|
|
47
|
+
hello-code, hello-tree, hello-rust
|
|
47
48
|
oxp dev [dir] Watch + repack + serve over ws/http (default port 7373)
|
|
48
49
|
oxp pack [dir] Build dist/<slug>-<version>.oxp from <dir> (default: cwd)
|
|
49
50
|
oxp login Sign in (email + password in terminal)
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,KA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O,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAChC,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,KAAK,QAAQ;YACX,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB;YACE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;YACjE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC;AAED,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAC9B,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAC5B,CAAC,GAAG,EAAE,EAAE;IACN,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAS,GAAa,CAAC,OAAO,IAAI,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AA0BA;;;GAGG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA8G5D"}
|
package/dist/commands/create.js
CHANGED
|
@@ -106,8 +106,10 @@ export async function create(args) {
|
|
|
106
106
|
info(` oxp pack && oxp publish # ship it`);
|
|
107
107
|
}
|
|
108
108
|
else {
|
|
109
|
+
// hello-html: React + TypeScript + esbuild
|
|
109
110
|
info(`Next steps:`);
|
|
110
111
|
info(` cd ${name}`);
|
|
112
|
+
info(` npm install # one-time`);
|
|
111
113
|
info(` oxp dev # live reload in IDE`);
|
|
112
114
|
info(` oxp pack && oxp publish # ship it`);
|
|
113
115
|
}
|
|
@@ -182,12 +184,17 @@ const TEXT_EXT = new Set([
|
|
|
182
184
|
".md",
|
|
183
185
|
".txt",
|
|
184
186
|
".js",
|
|
187
|
+
".mjs",
|
|
188
|
+
".cjs",
|
|
185
189
|
".ts",
|
|
190
|
+
".tsx",
|
|
191
|
+
".jsx",
|
|
186
192
|
".css",
|
|
187
193
|
".toml",
|
|
188
194
|
".rs",
|
|
189
195
|
".wit",
|
|
190
196
|
".gitignore",
|
|
197
|
+
".oxpignore",
|
|
191
198
|
]);
|
|
192
199
|
async function copyTree(src, dest, transform) {
|
|
193
200
|
await fs.mkdir(dest, { recursive: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,SAAS,GAAG;IAChB,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;CACJ,CAAC;AAEX,MAAM,gBAAgB,GAAiB,YAAY,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAc;IACzC,IAAI,QAAQ,GAAiB,gBAAgB,CAAC;IAC9C,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CA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O,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QACnE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACxB,MAAM,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;QACpC,CAAC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;YAC1B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YAC1D,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;gBAC1C,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAqCA,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAqLzD"}
|
package/dist/commands/dev.js
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `oxp dev [dir]` — watch a project, re-pack on changes, and serve the bundle
|
|
3
|
+
* over WebSocket + HTTP so a host can hot-load the extension without going
|
|
4
|
+
* through publish.
|
|
5
|
+
*
|
|
6
|
+
* Hosts that opt-in to dev mode (hosts/vscode/src/dev.ts, hosts/piye/src/dev.ts)
|
|
7
|
+
* connect to:
|
|
8
|
+
*
|
|
9
|
+
* ws://localhost:<port>/dev → JSON {kind:"reload", manifest, digest, bundle:base64}
|
|
10
|
+
* GET http://localhost:<port>/manifest → oxp.json
|
|
11
|
+
* GET http://localhost:<port>/bundle → raw .oxp bytes
|
|
12
|
+
* GET http://localhost:<port>/info → {dev:true, manifest, digest, bundleSize}
|
|
13
|
+
*
|
|
14
|
+
* IMPORTANT: dev mode SKIPS Ed25519 signing for speed. The host displays a
|
|
15
|
+
* loud "DEV: signature bypass" badge while connected. Production publish flow
|
|
16
|
+
* is unchanged.
|
|
17
|
+
*/
|
|
18
|
+
import { promises as fs } from "node:fs";
|
|
19
|
+
import { spawn } from "node:child_process";
|
|
1
20
|
import { createServer, } from "node:http";
|
|
2
|
-
import { resolve } from "node:path";
|
|
21
|
+
import { join, resolve } from "node:path";
|
|
3
22
|
import chokidar from "chokidar";
|
|
4
23
|
import { WebSocketServer } from "ws";
|
|
5
24
|
import { packBundle } from "@oxprotocol/bundle";
|
|
@@ -42,6 +61,18 @@ export async function dev(args) {
|
|
|
42
61
|
building = true;
|
|
43
62
|
try {
|
|
44
63
|
const t0 = Date.now();
|
|
64
|
+
// Run the manifest's build hook (e.g. `npm run build`) before
|
|
65
|
+
// packing, so React/TS templates that compile to ui/ get fresh
|
|
66
|
+
// output. Skipped if no scripts.build is set. Mirrors `oxp pack`.
|
|
67
|
+
const buildCmd = await readBuildScript(root);
|
|
68
|
+
if (buildCmd) {
|
|
69
|
+
const code = await runShell(buildCmd, root);
|
|
70
|
+
if (code !== 0) {
|
|
71
|
+
info(`✖ scripts.build exited ${code} — keeping previous bundle`);
|
|
72
|
+
broadcast({ kind: "error", message: `build hook exit ${code}` });
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
45
76
|
const r = await packBundle(root, {});
|
|
46
77
|
state = {
|
|
47
78
|
manifest: r.manifest,
|
|
@@ -104,9 +135,21 @@ export async function dev(args) {
|
|
|
104
135
|
ws.send(json);
|
|
105
136
|
}
|
|
106
137
|
}
|
|
138
|
+
// If the project has a `scripts.build` hook the `ui/` directory is
|
|
139
|
+
// generated output (see hello-html template). Watching it would cause
|
|
140
|
+
// an infinite rebuild loop. We watch `src/` and other source dirs
|
|
141
|
+
// instead — chokidar still picks them up via the root walk.
|
|
142
|
+
const hasBuildHook = (await readBuildScript(root)) != null;
|
|
107
143
|
// ── chokidar watch ───────────────────────────────────────────────────────
|
|
108
144
|
const watcher = chokidar.watch(root, {
|
|
109
|
-
ignored: (p) => /(^|[\\/])(\.git|node_modules|dist\/.*\.oxp|\.next|\.oxp-cache)([\\/]|$)/.test(p)
|
|
145
|
+
ignored: (p) => /(^|[\\/])(\.git|node_modules|dist\/.*\.oxp|\.next|\.oxp-cache)([\\/]|$)/.test(p) ||
|
|
146
|
+
// Generated build outputs — would cause infinite rebuild loops.
|
|
147
|
+
// When a build hook exists, ignore the entire `ui/` tree (it's
|
|
148
|
+
// 100% generated). Otherwise only ignore obvious bundler artefacts
|
|
149
|
+
// so authors who hand-write `ui/index.html` still get hot reload.
|
|
150
|
+
(hasBuildHook
|
|
151
|
+
? /(^|[\\/])ui([\\/]|$)/.test(p)
|
|
152
|
+
: /[\\/]ui[\\/](main|index)\.(js|css|html)(\.map)?$/.test(p)),
|
|
110
153
|
ignoreInitial: true,
|
|
111
154
|
});
|
|
112
155
|
let debounce = null;
|
|
@@ -120,13 +163,19 @@ export async function dev(args) {
|
|
|
120
163
|
// ── Initial build + start ────────────────────────────────────────────────
|
|
121
164
|
await rebuild("initial");
|
|
122
165
|
await new Promise((r) => http.listen(port, "127.0.0.1", r));
|
|
166
|
+
// Machine-readable line so IDE hosts can auto-detect when we're ready
|
|
167
|
+
// (used by VS Code's "OXP: Start Dev Session" command).
|
|
168
|
+
info(`OXP_DEV_READY port=${port}`);
|
|
169
|
+
info("");
|
|
170
|
+
info("oxp dev — backend ready. ⚠ DEV mode (signature bypass, do not ship)");
|
|
171
|
+
info(` watching: ${root}`);
|
|
172
|
+
info("");
|
|
173
|
+
info("This is a backend service for IDE hosts. Don't open it in a browser.");
|
|
174
|
+
info("Render the extension inside your IDE:");
|
|
123
175
|
info("");
|
|
124
|
-
info("
|
|
125
|
-
info("
|
|
126
|
-
info(
|
|
127
|
-
info(`│ http: http://localhost:${port}/info`.padEnd(60) + "│");
|
|
128
|
-
info(`│ root: ${root}`.padEnd(60) + "│");
|
|
129
|
-
info("╰───────────────────────────────────────────────────────────╯");
|
|
176
|
+
info(" • VS Code: run \u201cOXP: Start Dev Session\u201d (or it auto-attaches");
|
|
177
|
+
info(" if you launched dev from the IDE)");
|
|
178
|
+
info(" • JetBrains / Neovim: see hosts/<ide>/README.md");
|
|
130
179
|
info("");
|
|
131
180
|
info("Press Ctrl+C to stop.");
|
|
132
181
|
// Keep alive until SIGINT.
|
|
@@ -188,4 +237,31 @@ function send(res, status, body) {
|
|
|
188
237
|
res.setHeader("content-type", "application/json");
|
|
189
238
|
res.end(JSON.stringify(body));
|
|
190
239
|
}
|
|
240
|
+
// ── Build hook helpers (mirror pack.ts) ───────────────────────────────────
|
|
241
|
+
async function readBuildScript(root) {
|
|
242
|
+
try {
|
|
243
|
+
const raw = await fs.readFile(join(root, "oxp.json"), "utf8");
|
|
244
|
+
const m = JSON.parse(raw);
|
|
245
|
+
const cmd = m?.scripts?.build;
|
|
246
|
+
if (typeof cmd === "string" && cmd.trim().length > 0)
|
|
247
|
+
return cmd;
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
/* ignore */
|
|
251
|
+
}
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
function runShell(cmd, cwd) {
|
|
255
|
+
return new Promise((resolveExit) => {
|
|
256
|
+
info(`▸ ${cmd}`);
|
|
257
|
+
const child = spawn(cmd, {
|
|
258
|
+
cwd,
|
|
259
|
+
shell: true,
|
|
260
|
+
stdio: "inherit",
|
|
261
|
+
env: process.env,
|
|
262
|
+
});
|
|
263
|
+
child.on("exit", (code) => resolveExit(code ?? 1));
|
|
264
|
+
child.on("error", () => resolveExit(1));
|
|
265
|
+
});
|
|
266
|
+
}
|
|
191
267
|
//# sourceMappingURL=dev.js.map
|
package/dist/commands/dev.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,GAGb,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,eAAe,EAAkB,MAAM,IAAI,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AASzD,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc;IACtC,+BAA+B;IAC/B,IAAI,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC;IACpD,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,M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open eXtensions Protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,19 +24,14 @@
|
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsc -p tsconfig.json && chmod +x dist/cli.js",
|
|
29
|
-
"dev": "tsx src/cli.ts",
|
|
30
|
-
"test": "vitest run --passWithNoTests"
|
|
31
|
-
},
|
|
32
27
|
"dependencies": {
|
|
33
|
-
"@oxprotocol/bundle": "workspace:*",
|
|
34
|
-
"@oxprotocol/host-core": "workspace:*",
|
|
35
|
-
"@oxprotocol/schema": "workspace:*",
|
|
36
|
-
"@oxprotocol/types": "workspace:*",
|
|
37
|
-
"@oxprotocol/wit": "workspace:*",
|
|
38
28
|
"chokidar": "^4.0.3",
|
|
39
|
-
"ws": "^8.18.0"
|
|
29
|
+
"ws": "^8.18.0",
|
|
30
|
+
"@oxprotocol/bundle": "0.1.5",
|
|
31
|
+
"@oxprotocol/schema": "0.1.4",
|
|
32
|
+
"@oxprotocol/wit": "0.1.4",
|
|
33
|
+
"@oxprotocol/types": "0.1.4",
|
|
34
|
+
"@oxprotocol/host-core": "0.1.4"
|
|
40
35
|
},
|
|
41
36
|
"devDependencies": {
|
|
42
37
|
"@types/node": "^22.10.2",
|
|
@@ -44,5 +39,10 @@
|
|
|
44
39
|
"tsx": "^4.20.6",
|
|
45
40
|
"typescript": "5.9.3",
|
|
46
41
|
"vitest": "^2.1.8"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsc -p tsconfig.json && chmod +x dist/cli.js",
|
|
45
|
+
"dev": "tsx src/cli.ts",
|
|
46
|
+
"test": "vitest run --passWithNoTests"
|
|
47
47
|
}
|
|
48
|
-
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Files needed for development but not part of the shipped .oxp bundle.
|
|
2
|
+
# Source-of-truth lives at https://oxp.sh/docs/oxpignore
|
|
3
|
+
|
|
4
|
+
# React/TS source — bundled and inlined into ui/index.html by build.mjs
|
|
5
|
+
src/
|
|
6
|
+
|
|
7
|
+
# Tooling — only used at build time
|
|
8
|
+
build.mjs
|
|
9
|
+
package.json
|
|
10
|
+
package-lock.json
|
|
11
|
+
pnpm-lock.yaml
|
|
12
|
+
yarn.lock
|
|
13
|
+
tsconfig.json
|
|
14
|
+
|
|
15
|
+
# IDE / OS noise
|
|
16
|
+
.gitignore
|
|
17
|
+
.DS_Store
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
# __DISPLAY_NAME__
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A React + TypeScript OXP extension scaffolded by `oxp create`.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Layout
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
src/
|
|
9
|
+
App.tsx ← edit me
|
|
10
|
+
main.tsx ← React entry, mounts <App /> on #root
|
|
11
|
+
styles.css ← global styles, inlined into the bundle
|
|
12
|
+
build.mjs ← esbuild driver, emits a single inlined ui/index.html
|
|
13
|
+
ui/index.html ← (generated, git-ignored)
|
|
14
|
+
oxp.json ← extension manifest
|
|
15
|
+
.oxpignore ← excludes src/, build.mjs, etc. from the .oxp
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Why a single inlined HTML?
|
|
19
|
+
|
|
20
|
+
OXP's `ui-v1` policy forbids loose `.js` and `.css` files in a bundle —
|
|
21
|
+
only HTML may execute. `build.mjs` runs esbuild with `format: "iife"` and
|
|
22
|
+
inlines both the JS and CSS into one self-contained `ui/index.html`. That
|
|
23
|
+
HTML is the only artefact that ships in the `.oxp`.
|
|
24
|
+
|
|
25
|
+
## Develop
|
|
6
26
|
|
|
7
27
|
```sh
|
|
8
|
-
|
|
28
|
+
npm install # one-time
|
|
29
|
+
oxp dev # watches files, rebuilds, serves to your IDE host
|
|
9
30
|
```
|
|
10
31
|
|
|
11
|
-
|
|
32
|
+
`oxp dev` runs `scripts.build` from `oxp.json` (`npm run build`, which
|
|
33
|
+
executes `node build.mjs`) before each repack.
|
|
12
34
|
|
|
13
|
-
##
|
|
35
|
+
## Ship
|
|
14
36
|
|
|
15
37
|
```sh
|
|
16
|
-
oxp
|
|
17
|
-
oxp publish
|
|
38
|
+
oxp pack # produces dist/__SLUG__-<version>.oxp + .sig.json
|
|
39
|
+
oxp publish # uploads to https://oxp.sh
|
|
18
40
|
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// Build the OXP UI bundle.
|
|
2
|
+
//
|
|
3
|
+
// Why is this not just `esbuild --outdir=ui`?
|
|
4
|
+
// Because OXP's `ui-v1` policy forbids loose `.js` / `.css` files in the
|
|
5
|
+
// bundle for safety (CSP-style — only HTML may execute). So we build the
|
|
6
|
+
// React app and inline both the JS and the CSS into a single self-contained
|
|
7
|
+
// `ui/index.html`. That HTML is the only artefact that ships in the .oxp.
|
|
8
|
+
//
|
|
9
|
+
// Watch mode (`oxp dev`) re-runs this on every save.
|
|
10
|
+
|
|
11
|
+
import { context, build } from "esbuild";
|
|
12
|
+
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
13
|
+
|
|
14
|
+
const watch = process.argv.includes("--watch");
|
|
15
|
+
|
|
16
|
+
const entry = "src/main.tsx";
|
|
17
|
+
|
|
18
|
+
const buildOptions = {
|
|
19
|
+
entryPoints: [entry],
|
|
20
|
+
bundle: true,
|
|
21
|
+
minify: !watch,
|
|
22
|
+
sourcemap: false, // inline maps would inflate the HTML; off in dev too
|
|
23
|
+
target: "es2020",
|
|
24
|
+
format: "iife", // executes immediately when injected via <script>
|
|
25
|
+
loader: { ".css": "css" },
|
|
26
|
+
legalComments: "none",
|
|
27
|
+
write: false,
|
|
28
|
+
outdir: "out",
|
|
29
|
+
logLevel: "warning",
|
|
30
|
+
plugins: [
|
|
31
|
+
{
|
|
32
|
+
name: "oxp-inline-html",
|
|
33
|
+
setup(b) {
|
|
34
|
+
b.onEnd(async (result) => {
|
|
35
|
+
if (result.errors.length > 0) return;
|
|
36
|
+
await emitInlinedHtml(result);
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
async function emitInlinedHtml(result) {
|
|
44
|
+
let js = "";
|
|
45
|
+
let css = "";
|
|
46
|
+
for (const f of result.outputFiles ?? []) {
|
|
47
|
+
if (f.path.endsWith(".js")) js = f.text;
|
|
48
|
+
else if (f.path.endsWith(".css")) css = f.text;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Pull display name from oxp.json so the <title> stays in sync.
|
|
52
|
+
let title = "OXP Extension";
|
|
53
|
+
try {
|
|
54
|
+
const m = JSON.parse(await readFile("oxp.json", "utf8"));
|
|
55
|
+
if (typeof m.displayName === "string") title = m.displayName;
|
|
56
|
+
} catch {
|
|
57
|
+
/* fall back */
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const html = `<!doctype html>
|
|
61
|
+
<html lang="en">
|
|
62
|
+
<head>
|
|
63
|
+
<meta charset="utf-8" />
|
|
64
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
65
|
+
<title>${escapeHtml(title)}</title>
|
|
66
|
+
<style>${css}</style>
|
|
67
|
+
</head>
|
|
68
|
+
<body>
|
|
69
|
+
<div id="root"></div>
|
|
70
|
+
<script>${js}</script>
|
|
71
|
+
</body>
|
|
72
|
+
</html>
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
await mkdir("ui", { recursive: true });
|
|
76
|
+
await writeFile("ui/index.html", html);
|
|
77
|
+
const kb = (html.length / 1024).toFixed(1);
|
|
78
|
+
console.log(`✓ ui/index.html (${kb} KiB)`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function escapeHtml(s) {
|
|
82
|
+
return s
|
|
83
|
+
.replace(/&/g, "&")
|
|
84
|
+
.replace(/</g, "<")
|
|
85
|
+
.replace(/>/g, ">")
|
|
86
|
+
.replace(/"/g, """);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (watch) {
|
|
90
|
+
const ctx = await context(buildOptions);
|
|
91
|
+
await ctx.watch();
|
|
92
|
+
console.log("watching src/ — Ctrl+C to stop");
|
|
93
|
+
} else {
|
|
94
|
+
await build(buildOptions);
|
|
95
|
+
}
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
"publisher": "__PUBLISHER__",
|
|
5
5
|
"version": "0.0.1",
|
|
6
6
|
"displayName": "__DISPLAY_NAME__",
|
|
7
|
-
"description": "
|
|
7
|
+
"description": "OXP extension built with React + TypeScript.",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"categories": ["other"],
|
|
10
10
|
"engines": { "oxp": "^1.0.0" },
|
|
11
11
|
"main": { "ui": "ui/index.html" },
|
|
12
12
|
"ui": { "components": "oxp-ui-only", "preferredSurface": "panel" },
|
|
13
|
-
"permissions": []
|
|
13
|
+
"permissions": [],
|
|
14
|
+
"scripts": { "build": "npm run build" }
|
|
14
15
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__SLUG__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "node build.mjs",
|
|
8
|
+
"dev": "node build.mjs --watch",
|
|
9
|
+
"typecheck": "tsc --noEmit"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"react": "^18.3.1",
|
|
13
|
+
"react-dom": "^18.3.1"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@types/react": "^18.3.12",
|
|
17
|
+
"@types/react-dom": "^18.3.1",
|
|
18
|
+
"esbuild": "^0.24.0",
|
|
19
|
+
"typescript": "^5.6.3"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Replace this with whatever your extension does. Everything inside the
|
|
5
|
+
* panel is plain React + DOM — no host-specific APIs needed for UI work.
|
|
6
|
+
*
|
|
7
|
+
* To talk to the host (read settings, run commands, log telemetry, etc.)
|
|
8
|
+
* import from `@oxprotocol/sdk` and add the matching permission to
|
|
9
|
+
* `oxp.json#permissions`.
|
|
10
|
+
*/
|
|
11
|
+
export function App(): JSX.Element {
|
|
12
|
+
const [count, setCount] = useState(0);
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<main className="oxp-card">
|
|
16
|
+
<header className="oxp-header">
|
|
17
|
+
<span className="oxp-dot" aria-hidden />
|
|
18
|
+
<span className="oxp-brand">OXP</span>
|
|
19
|
+
<span className="oxp-slug">@__PUBLISHER__/__SLUG__</span>
|
|
20
|
+
</header>
|
|
21
|
+
|
|
22
|
+
<h1>__DISPLAY_NAME__</h1>
|
|
23
|
+
<p className="oxp-lede">
|
|
24
|
+
React + TypeScript panel running inside your IDE.
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<button
|
|
28
|
+
className="oxp-btn"
|
|
29
|
+
type="button"
|
|
30
|
+
onClick={() => setCount((c) => c + 1)}
|
|
31
|
+
>
|
|
32
|
+
Pressed {count} {count === 1 ? "time" : "times"}
|
|
33
|
+
</button>
|
|
34
|
+
|
|
35
|
+
<p className="oxp-hint">
|
|
36
|
+
Edit <code>src/App.tsx</code> and save — the panel hot-reloads.
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<footer className="oxp-footer">
|
|
40
|
+
<a
|
|
41
|
+
href="https://oxp.sh/docs/getting-started"
|
|
42
|
+
target="_blank"
|
|
43
|
+
rel="noreferrer"
|
|
44
|
+
>
|
|
45
|
+
Docs ↗
|
|
46
|
+
</a>
|
|
47
|
+
<span aria-hidden>·</span>
|
|
48
|
+
<a href="https://oxp.sh/docs/api" target="_blank" rel="noreferrer">
|
|
49
|
+
SDK API ↗
|
|
50
|
+
</a>
|
|
51
|
+
</footer>
|
|
52
|
+
</main>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: dark light;
|
|
3
|
+
--oxp-bg: #060a13;
|
|
4
|
+
--oxp-fg: #f8fafc;
|
|
5
|
+
--oxp-muted: rgba(248, 250, 252, 0.45);
|
|
6
|
+
--oxp-accent: #7dd3fc;
|
|
7
|
+
--oxp-border: rgba(125, 211, 252, 0.18);
|
|
8
|
+
--oxp-border-strong: rgba(125, 211, 252, 0.4);
|
|
9
|
+
--oxp-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
* {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
min-height: 100vh;
|
|
19
|
+
display: grid;
|
|
20
|
+
place-items: center;
|
|
21
|
+
padding: 1.5rem;
|
|
22
|
+
font-family: -apple-system, system-ui, "Segoe UI", sans-serif;
|
|
23
|
+
background:
|
|
24
|
+
radial-gradient(
|
|
25
|
+
circle at 50% 0%,
|
|
26
|
+
rgba(125, 211, 252, 0.06),
|
|
27
|
+
transparent 60%
|
|
28
|
+
),
|
|
29
|
+
var(--oxp-bg);
|
|
30
|
+
color: var(--oxp-fg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.oxp-card {
|
|
34
|
+
width: 100%;
|
|
35
|
+
max-width: 28rem;
|
|
36
|
+
border: 1px solid var(--oxp-border);
|
|
37
|
+
border-radius: 8px;
|
|
38
|
+
padding: 1.75rem 2rem;
|
|
39
|
+
background: rgba(125, 211, 252, 0.03);
|
|
40
|
+
backdrop-filter: blur(8px);
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
gap: 1rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.oxp-header {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
gap: 0.5rem;
|
|
50
|
+
font-family: var(--oxp-mono);
|
|
51
|
+
font-size: 0.65rem;
|
|
52
|
+
letter-spacing: 0.18em;
|
|
53
|
+
text-transform: uppercase;
|
|
54
|
+
color: var(--oxp-muted);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.oxp-dot {
|
|
58
|
+
width: 6px;
|
|
59
|
+
height: 6px;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
background: #10b981;
|
|
62
|
+
box-shadow: 0 0 6px #10b981;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.oxp-brand {
|
|
66
|
+
color: var(--oxp-accent);
|
|
67
|
+
font-weight: 700;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.oxp-slug {
|
|
71
|
+
margin-left: auto;
|
|
72
|
+
color: var(--oxp-muted);
|
|
73
|
+
font-size: 0.6rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
h1 {
|
|
77
|
+
margin: 0;
|
|
78
|
+
font-size: 1.5rem;
|
|
79
|
+
letter-spacing: -0.01em;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.oxp-lede {
|
|
83
|
+
margin: 0;
|
|
84
|
+
color: var(--oxp-muted);
|
|
85
|
+
font-size: 0.85rem;
|
|
86
|
+
line-height: 1.5;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.oxp-btn {
|
|
90
|
+
align-self: flex-start;
|
|
91
|
+
margin-top: 0.25rem;
|
|
92
|
+
padding: 0.55rem 1rem;
|
|
93
|
+
font-family: var(--oxp-mono);
|
|
94
|
+
font-size: 0.75rem;
|
|
95
|
+
letter-spacing: 0.1em;
|
|
96
|
+
text-transform: uppercase;
|
|
97
|
+
color: var(--oxp-accent);
|
|
98
|
+
background: rgba(125, 211, 252, 0.06);
|
|
99
|
+
border: 1px solid var(--oxp-border-strong);
|
|
100
|
+
border-radius: 4px;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
transition: background 120ms ease, transform 80ms ease;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.oxp-btn:hover {
|
|
106
|
+
background: rgba(125, 211, 252, 0.12);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.oxp-btn:active {
|
|
110
|
+
transform: translateY(1px);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.oxp-hint {
|
|
114
|
+
margin: 0;
|
|
115
|
+
font-family: var(--oxp-mono);
|
|
116
|
+
font-size: 0.7rem;
|
|
117
|
+
color: var(--oxp-muted);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.oxp-hint code {
|
|
121
|
+
color: var(--oxp-accent);
|
|
122
|
+
background: rgba(125, 211, 252, 0.08);
|
|
123
|
+
padding: 0.1em 0.35em;
|
|
124
|
+
border-radius: 3px;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.oxp-footer {
|
|
128
|
+
display: flex;
|
|
129
|
+
gap: 0.5rem;
|
|
130
|
+
align-items: center;
|
|
131
|
+
margin-top: 0.5rem;
|
|
132
|
+
padding-top: 0.85rem;
|
|
133
|
+
border-top: 1px solid var(--oxp-border);
|
|
134
|
+
font-family: var(--oxp-mono);
|
|
135
|
+
font-size: 0.7rem;
|
|
136
|
+
color: var(--oxp-muted);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.oxp-footer a {
|
|
140
|
+
color: var(--oxp-accent);
|
|
141
|
+
text-decoration: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.oxp-footer a:hover {
|
|
145
|
+
text-decoration: underline;
|
|
146
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"jsx": "react-jsx",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"isolatedModules": true,
|
|
11
|
+
"noEmit": true,
|
|
12
|
+
"lib": [
|
|
13
|
+
"ES2020",
|
|
14
|
+
"DOM",
|
|
15
|
+
"DOM.Iterable"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"include": [
|
|
19
|
+
"src"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<title>__DISPLAY_NAME__</title>
|
|
6
|
-
<style>
|
|
7
|
-
:root {
|
|
8
|
-
color-scheme: dark light;
|
|
9
|
-
}
|
|
10
|
-
body {
|
|
11
|
-
margin: 0;
|
|
12
|
-
min-height: 100vh;
|
|
13
|
-
display: grid;
|
|
14
|
-
place-items: center;
|
|
15
|
-
font-family: -apple-system, system-ui, sans-serif;
|
|
16
|
-
background: #060a13;
|
|
17
|
-
color: #f8fafc;
|
|
18
|
-
}
|
|
19
|
-
.card {
|
|
20
|
-
border: 1px solid rgba(125, 211, 252, 0.3);
|
|
21
|
-
padding: 2rem 2.5rem;
|
|
22
|
-
border-radius: 8px;
|
|
23
|
-
text-align: center;
|
|
24
|
-
}
|
|
25
|
-
h1 {
|
|
26
|
-
margin: 0 0 0.5rem;
|
|
27
|
-
font-size: 1.75rem;
|
|
28
|
-
}
|
|
29
|
-
p {
|
|
30
|
-
margin: 0;
|
|
31
|
-
opacity: 0.6;
|
|
32
|
-
font-family: ui-monospace, monospace;
|
|
33
|
-
font-size: 0.75rem;
|
|
34
|
-
}
|
|
35
|
-
</style>
|
|
36
|
-
</head>
|
|
37
|
-
<body>
|
|
38
|
-
<div class="card">
|
|
39
|
-
<h1>Hello, OXP world.</h1>
|
|
40
|
-
<p>@__PUBLISHER__/__SLUG__</p>
|
|
41
|
-
</div>
|
|
42
|
-
</body>
|
|
43
|
-
</html>
|