@pwfabric/cli 0.0.0-stage → 1.0.0-rc.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 +202 -0
- package/README.md +122 -2
- package/dist/args.d.ts +12 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +43 -0
- package/dist/args.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +10 -0
- package/dist/bin.js.map +1 -0
- package/dist/commands/add.d.ts +4 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +56 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/build.d.ts +4 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +55 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/create.d.ts +10 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +119 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dev.d.ts +13 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +107 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/lib/flags.d.ts +11 -0
- package/dist/commands/lib/flags.d.ts.map +1 -0
- package/dist/commands/lib/flags.js +33 -0
- package/dist/commands/lib/flags.js.map +1 -0
- package/dist/commands/lib/identity.d.ts +39 -0
- package/dist/commands/lib/identity.d.ts.map +1 -0
- package/dist/commands/lib/identity.js +120 -0
- package/dist/commands/lib/identity.js.map +1 -0
- package/dist/commands/lib/project.d.ts +35 -0
- package/dist/commands/lib/project.d.ts.map +1 -0
- package/dist/commands/lib/project.js +78 -0
- package/dist/commands/lib/project.js.map +1 -0
- package/dist/commands/lib/report.d.ts +16 -0
- package/dist/commands/lib/report.d.ts.map +1 -0
- package/dist/commands/lib/report.js +75 -0
- package/dist/commands/lib/report.js.map +1 -0
- package/dist/commands/lib/starter.d.ts +42 -0
- package/dist/commands/lib/starter.d.ts.map +1 -0
- package/dist/commands/lib/starter.js +136 -0
- package/dist/commands/lib/starter.js.map +1 -0
- package/dist/commands/lib/static-server.d.ts +46 -0
- package/dist/commands/lib/static-server.d.ts.map +1 -0
- package/dist/commands/lib/static-server.js +173 -0
- package/dist/commands/lib/static-server.js.map +1 -0
- package/dist/commands/pack.d.ts +6 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +56 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/registry.d.ts +8 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +16 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +79 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/types.d.ts +35 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +10 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +33 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/dev/assemble.d.ts +48 -0
- package/dist/dev/assemble.d.ts.map +1 -0
- package/dist/dev/assemble.js +339 -0
- package/dist/dev/assemble.js.map +1 -0
- package/dist/dev/compile.d.ts +55 -0
- package/dist/dev/compile.d.ts.map +1 -0
- package/dist/dev/compile.js +215 -0
- package/dist/dev/compile.js.map +1 -0
- package/dist/dev/csp.d.ts +68 -0
- package/dist/dev/csp.d.ts.map +1 -0
- package/dist/dev/csp.js +260 -0
- package/dist/dev/csp.js.map +1 -0
- package/dist/dev/diagnostics.d.ts +22 -0
- package/dist/dev/diagnostics.d.ts.map +1 -0
- package/dist/dev/diagnostics.js +22 -0
- package/dist/dev/diagnostics.js.map +1 -0
- package/dist/dev/envelope.d.ts +93 -0
- package/dist/dev/envelope.d.ts.map +1 -0
- package/dist/dev/envelope.js +154 -0
- package/dist/dev/envelope.js.map +1 -0
- package/dist/dev/media.d.ts +54 -0
- package/dist/dev/media.d.ts.map +1 -0
- package/dist/dev/media.js +128 -0
- package/dist/dev/media.js.map +1 -0
- package/dist/dev/needs-host.d.ts +3 -0
- package/dist/dev/needs-host.d.ts.map +1 -0
- package/dist/dev/needs-host.js +32 -0
- package/dist/dev/needs-host.js.map +1 -0
- package/dist/dev/output.d.ts +10 -0
- package/dist/dev/output.d.ts.map +1 -0
- package/dist/dev/output.js +32 -0
- package/dist/dev/output.js.map +1 -0
- package/dist/dev/overlay.d.ts +22 -0
- package/dist/dev/overlay.d.ts.map +1 -0
- package/dist/dev/overlay.js +59 -0
- package/dist/dev/overlay.js.map +1 -0
- package/dist/dev/server.d.ts +28 -0
- package/dist/dev/server.d.ts.map +1 -0
- package/dist/dev/server.js +264 -0
- package/dist/dev/server.js.map +1 -0
- package/dist/dev/shell.d.ts +83 -0
- package/dist/dev/shell.d.ts.map +1 -0
- package/dist/dev/shell.js +244 -0
- package/dist/dev/shell.js.map +1 -0
- package/dist/dev/sources.d.ts +46 -0
- package/dist/dev/sources.d.ts.map +1 -0
- package/dist/dev/sources.js +165 -0
- package/dist/dev/sources.js.map +1 -0
- package/dist/dev/theme.d.ts +52 -0
- package/dist/dev/theme.d.ts.map +1 -0
- package/dist/dev/theme.js +185 -0
- package/dist/dev/theme.js.map +1 -0
- package/dist/dev/types.d.ts +41 -0
- package/dist/dev/types.d.ts.map +1 -0
- package/dist/dev/types.js +11 -0
- package/dist/dev/types.js.map +1 -0
- package/dist/dev/watcher.d.ts +30 -0
- package/dist/dev/watcher.d.ts.map +1 -0
- package/dist/dev/watcher.js +150 -0
- package/dist/dev/watcher.js.map +1 -0
- package/dist/host/definitions.d.ts +62 -0
- package/dist/host/definitions.d.ts.map +1 -0
- package/dist/host/definitions.js +136 -0
- package/dist/host/definitions.js.map +1 -0
- package/dist/host/http.d.ts +40 -0
- package/dist/host/http.d.ts.map +1 -0
- package/dist/host/http.js +156 -0
- package/dist/host/http.js.map +1 -0
- package/dist/host/local-host.d.ts +60 -0
- package/dist/host/local-host.d.ts.map +1 -0
- package/dist/host/local-host.js +420 -0
- package/dist/host/local-host.js.map +1 -0
- package/dist/host/oidc.d.ts +47 -0
- package/dist/host/oidc.d.ts.map +1 -0
- package/dist/host/oidc.js +192 -0
- package/dist/host/oidc.js.map +1 -0
- package/dist/host/query.d.ts +36 -0
- package/dist/host/query.d.ts.map +1 -0
- package/dist/host/query.js +158 -0
- package/dist/host/query.js.map +1 -0
- package/dist/host/receipts.d.ts +26 -0
- package/dist/host/receipts.d.ts.map +1 -0
- package/dist/host/receipts.js +72 -0
- package/dist/host/receipts.js.map +1 -0
- package/dist/host/records.d.ts +74 -0
- package/dist/host/records.d.ts.map +1 -0
- package/dist/host/records.js +229 -0
- package/dist/host/records.js.map +1 -0
- package/dist/host/tokens.d.ts +29 -0
- package/dist/host/tokens.d.ts.map +1 -0
- package/dist/host/tokens.js +52 -0
- package/dist/host/tokens.js.map +1 -0
- package/dist/host/types.d.ts +33 -0
- package/dist/host/types.d.ts.map +1 -0
- package/dist/host/types.js +11 -0
- package/dist/host/types.js.map +1 -0
- package/dist/index.d.ts +17 -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 +65 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,123 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pwf
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The PWFabric command line. It creates, checks, packs and serves PWFabric apps
|
|
4
|
+
using only the engine's own packages. It never calls a hosted service: there is
|
|
5
|
+
no login, publish or deploy.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pwf create my-shop --foundation ./foundation # a new app folder
|
|
9
|
+
cd my-shop
|
|
10
|
+
pwf validate # check it
|
|
11
|
+
pwf pack # write my-shop-0.1.0.pwpack
|
|
12
|
+
pwf add ../cards-2.1.0.pwpack # install and pin another pack
|
|
13
|
+
pwf run ./dist-app # serve a built pwapp
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Every command prints `--help`. Exit codes: `0` success, `1` failure (invalid
|
|
17
|
+
pack, missing file, refused write), `2` wrong usage.
|
|
18
|
+
|
|
19
|
+
## The project folder
|
|
20
|
+
|
|
21
|
+
`pwf create` writes a canonical pwpack folder (see the pwpack format in the
|
|
22
|
+
PWFabric specification):
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
my-shop/
|
|
26
|
+
├── pwpack.json id @pwpack/local/my-shop, 0.1.0, pins the foundation
|
|
27
|
+
├── app/
|
|
28
|
+
│ ├── plan.json
|
|
29
|
+
│ ├── definitions/appearance.json uses one of the foundation's themes
|
|
30
|
+
│ ├── definitions/navigation.json
|
|
31
|
+
│ └── surfaces/home.receipt.json a heading, a text and a button from the foundation
|
|
32
|
+
├── atoms/README.md your own blocks go here (the README is never packed)
|
|
33
|
+
├── .gitignore .pwf/ and *.pwpack
|
|
34
|
+
└── .pwf/packs/<id>@<version>/ local copies of the pinned packs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
`pwpack.json` members are always written in the order `id`, `version`,
|
|
38
|
+
`formatVersion`, `engines`, `requires`, `license`, `app`, `packs`, with
|
|
39
|
+
two-space indentation.
|
|
40
|
+
|
|
41
|
+
## Commands
|
|
42
|
+
|
|
43
|
+
### `pwf create <name> [--dir <path>] [--foundation <folder|.pwpack>] [--force]`
|
|
44
|
+
|
|
45
|
+
Creates the folder above. Every app stands on a foundation pack; it is not
|
|
46
|
+
published to a registry yet, so give its folder or `.pwpack` with
|
|
47
|
+
`--foundation`, or set `PWF_FOUNDATION` once. The foundation's pack content
|
|
48
|
+
(not its tooling — `package.json`, `scripts/`, tests) is copied into
|
|
49
|
+
`.pwf/packs/` and pinned by its content hash, so later commands work offline.
|
|
50
|
+
`engines.pwfabric` covers the engine version `pwf` was installed with, up to
|
|
51
|
+
the next major. A folder that is not empty is refused unless `--force` is
|
|
52
|
+
given (existing files are kept, generated ones overwritten).
|
|
53
|
+
|
|
54
|
+
### `pwf validate [dir] [--json]`
|
|
55
|
+
|
|
56
|
+
Reads the folder, runs the pack validator and prints its findings grouped as
|
|
57
|
+
errors, warnings and notes, with the path each one is about. It also checks
|
|
58
|
+
every `packs[]` pin against `.pwf/packs/<id>@<version>/`: a pinned build that
|
|
59
|
+
is not there is a warning (`PIN_NOT_CACHED`), one whose content hash differs is
|
|
60
|
+
an error (`PIN_HASH_MISMATCH`). Exit `1` on any error. `--json` prints the raw
|
|
61
|
+
result.
|
|
62
|
+
|
|
63
|
+
### `pwf pack [dir] [--out <file>]`
|
|
64
|
+
|
|
65
|
+
Validates (and refuses on errors), then writes the deterministic archive
|
|
66
|
+
`<name>-<version>.pwpack` into the folder, or to `--out`. Prints the path, its
|
|
67
|
+
size and the content hash. The archive holds the pack content only —
|
|
68
|
+
`pwpack.json`, `LICENSE`, `NOTICE`, `README.md`, `app/`, `atoms/` and `media/`
|
|
69
|
+
(pwpack-format §1.2) — so `.pwf/`, `.gitignore`, earlier `.pwpack` files and
|
|
70
|
+
the author's tooling are never included, and the folder and its archive hash
|
|
71
|
+
the same. Markdown notes under `atoms/` (such as the `atoms/README.md` that
|
|
72
|
+
`create` writes) are documentation and travel with the pack. The same folder
|
|
73
|
+
always gives the same bytes.
|
|
74
|
+
|
|
75
|
+
### `pwf add <path-to.pwpack|dir> [--dir <project>]`
|
|
76
|
+
|
|
77
|
+
Validates the pack, copies its pack content to `.pwf/packs/<id>@<version>/`,
|
|
78
|
+
pins it in `packs[]` by the content hash of exactly what was copied and adds `{ id, range: "^<major>.0.0" }` to
|
|
79
|
+
`requires` (replacing an earlier entry for the same id). Only local archives
|
|
80
|
+
and folders: resolving packs from npm or a pack registry is not supported.
|
|
81
|
+
|
|
82
|
+
### `pwf dev [dir] [--port <n>] [--host <name>] [--local-host | --no-host]`
|
|
83
|
+
|
|
84
|
+
Assembles the app in memory, serves it on `http://127.0.0.1:4600/` (`--port 0`
|
|
85
|
+
picks a free port), rebuilds on every change and reloads the page. While a
|
|
86
|
+
build has errors the page shows them, and so does the terminal.
|
|
87
|
+
|
|
88
|
+
When the app declares sign-in (`app/definitions/auth.json`) or records
|
|
89
|
+
(`app/definitions/entities.json`), `pwf dev` mounts the **local host** under
|
|
90
|
+
`/_host` on the same server: the session protocol (password door, provider
|
|
91
|
+
round trip, an issuer stand-in for an external topology) and the record
|
|
92
|
+
endpoints of the data protocol, with records in memory seeded from
|
|
93
|
+
`app/data/<Entity>.json`. The envelope then carries the host's `auth.json`, and
|
|
94
|
+
its receipts — entity sources rewritten to `rest` sources against
|
|
95
|
+
`/_host/records/<Entity>` — replace the folder's copies. `--local-host` mounts
|
|
96
|
+
it for an app that declares neither; `--no-host` serves the pages alone. The
|
|
97
|
+
local host is for development only: one user, any password, nothing survives
|
|
98
|
+
a restart.
|
|
99
|
+
|
|
100
|
+
### `pwf build [dir] [--out <dir>]`
|
|
101
|
+
|
|
102
|
+
Assembles the app into a static pwapp folder (default `<dir>/.pwf/out/`) for
|
|
103
|
+
`pwf run` or any static host. The folder carries the app's Content Security
|
|
104
|
+
Policy, derived from what the app declares (pwapp-format §2.1): as a `<meta>`
|
|
105
|
+
in `index.html`, as `_headers`, and as `publish.json` `csp`.
|
|
106
|
+
|
|
107
|
+
### `pwf run <dir|file.pwapp> [--port <n>] [--host <name>]`
|
|
108
|
+
|
|
109
|
+
Serves a built pwapp (any folder with an `index.html`, or a `.pwapp` archive
|
|
110
|
+
opened in memory) on `http://127.0.0.1:4700/` by default; `--port 0` picks a
|
|
111
|
+
free port. Page paths without a file extension are answered with `index.html`,
|
|
112
|
+
so path-routed apps work; a missing asset is a 404. Headers the folder's
|
|
113
|
+
`_headers` file declares (the app's policy) are sent with matching files.
|
|
114
|
+
Stop it with Ctrl-C.
|
|
115
|
+
|
|
116
|
+
## Programmatic use
|
|
117
|
+
|
|
118
|
+
The commands are plain objects (`COMMANDS` from the package entry) that write
|
|
119
|
+
through a `CommandIO` and resolve to an exit code, so they run in-process.
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
Apache-2.0
|
package/dist/args.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ParsedArgs } from './commands/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Splits argv (without the node binary and script) into the command name and
|
|
4
|
+
* its arguments. `--flag value` and `--flag=value` become strings, a bare
|
|
5
|
+
* `--flag` (or one followed by another flag) becomes true, and everything
|
|
6
|
+
* after a lone `--` is positional.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseArgs(argv: readonly string[]): {
|
|
9
|
+
command: string | undefined;
|
|
10
|
+
args: ParsedArgs;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAErD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG;IAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CA8BpG"}
|
package/dist/args.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits argv (without the node binary and script) into the command name and
|
|
3
|
+
* its arguments. `--flag value` and `--flag=value` become strings, a bare
|
|
4
|
+
* `--flag` (or one followed by another flag) becomes true, and everything
|
|
5
|
+
* after a lone `--` is positional.
|
|
6
|
+
*/
|
|
7
|
+
export function parseArgs(argv) {
|
|
8
|
+
const positionals = [];
|
|
9
|
+
const flags = {};
|
|
10
|
+
let rest = false;
|
|
11
|
+
for (let i = 0; i < argv.length; i++) {
|
|
12
|
+
const a = argv[i];
|
|
13
|
+
if (rest) {
|
|
14
|
+
positionals.push(a);
|
|
15
|
+
}
|
|
16
|
+
else if (a === '--') {
|
|
17
|
+
rest = true;
|
|
18
|
+
}
|
|
19
|
+
else if (a.startsWith('--')) {
|
|
20
|
+
const body = a.slice(2);
|
|
21
|
+
const eq = body.indexOf('=');
|
|
22
|
+
if (eq >= 0) {
|
|
23
|
+
flags[body.slice(0, eq)] = body.slice(eq + 1);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
const next = argv[i + 1];
|
|
27
|
+
if (next !== undefined && !next.startsWith('--')) {
|
|
28
|
+
flags[body] = next;
|
|
29
|
+
i++;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
flags[body] = true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
positionals.push(a);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const [command, ...rest_] = positionals;
|
|
41
|
+
return { command, args: { positionals: rest_, flags } };
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=args.js.map
|
package/dist/args.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAuB;IAC/C,MAAM,WAAW,GAAa,EAAE,CAAA;IAChC,MAAM,KAAK,GAAqC,EAAE,CAAA;IAClD,IAAI,IAAI,GAAG,KAAK,CAAA;IAChB,KAAK,IAAI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,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAA;AACzD,CAAC"}
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from './index.js';
|
|
3
|
+
const code = await main(process.argv.slice(2), {
|
|
4
|
+
cwd: process.cwd(),
|
|
5
|
+
out: (line) => process.stdout.write(line + '\n'),
|
|
6
|
+
err: (line) => process.stderr.write(line + '\n'),
|
|
7
|
+
env: process.env,
|
|
8
|
+
});
|
|
9
|
+
process.exitCode = code;
|
|
10
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IAC7C,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAClB,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAChD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;IAChD,GAAG,EAAE,OAAO,CAAC,GAAG;CACjB,CAAC,CAAA;AACF,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAMhE,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAgC7E;AAED,eAAO,MAAM,GAAG,EAAE,OAcjB,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pwf add <pack>` — install a pack build into the project cache and pin it.
|
|
3
|
+
*/
|
|
4
|
+
import { hashPack, packContent, validatePack } from '@pwfabric/pack';
|
|
5
|
+
import { guard, stringFlag, UsageError } from './lib/flags.js';
|
|
6
|
+
import { cacheDir, cacheRelDir, readPackSource, resolveFrom, writePackFolder } from './lib/project.js';
|
|
7
|
+
import { caretRange, readIdentityFile, upsertPin, upsertRequirement, writeIdentityFile } from './lib/identity.js';
|
|
8
|
+
import { printIssues } from './lib/report.js';
|
|
9
|
+
export async function runAdd(args, io) {
|
|
10
|
+
const source = args.positionals[0];
|
|
11
|
+
if (source === undefined)
|
|
12
|
+
throw new UsageError('missing <path-to.pwpack|dir>');
|
|
13
|
+
const root = resolveFrom(io.cwd, stringFlag(args, 'dir'));
|
|
14
|
+
const doc = await readIdentityFile(root);
|
|
15
|
+
const sourceAbs = resolveFrom(io.cwd, source);
|
|
16
|
+
const incoming = await readPackSource(sourceAbs);
|
|
17
|
+
const checked = validatePack(incoming);
|
|
18
|
+
if (!checked.ok || !checked.identity) {
|
|
19
|
+
io.err(`pwf add: ${sourceAbs} is not a valid pack`);
|
|
20
|
+
printIssues(io, checked.issues.filter((i) => i.severity === 'error'));
|
|
21
|
+
return 1;
|
|
22
|
+
}
|
|
23
|
+
const { id, version } = checked.identity;
|
|
24
|
+
if (id === doc.id) {
|
|
25
|
+
io.err(`pwf add: ${id} is this project itself`);
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
// Only the pack content is installed; the pin is the hash of exactly that.
|
|
29
|
+
const content = packContent(incoming);
|
|
30
|
+
const hash = hashPack(content);
|
|
31
|
+
await writePackFolder(cacheDir(root, id, version), content);
|
|
32
|
+
upsertPin(doc, { id, version, hash });
|
|
33
|
+
upsertRequirement(doc, id, caretRange(version));
|
|
34
|
+
await writeIdentityFile(root, doc);
|
|
35
|
+
io.out(`Added ${id}@${version}`);
|
|
36
|
+
io.out(` cached in ${cacheRelDir(id, version)}`);
|
|
37
|
+
io.out(` pinned ${hash}`);
|
|
38
|
+
io.out(` requires ${caretRange(version)}`);
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
export const add = {
|
|
42
|
+
name: 'add',
|
|
43
|
+
summary: 'Install a pack (.pwpack or folder) into the project and pin it',
|
|
44
|
+
usage: `pwf add <path-to.pwpack|dir> [--dir <project>]
|
|
45
|
+
|
|
46
|
+
<path> a .pwpack (or .tgz) archive, or a pwpack folder
|
|
47
|
+
--dir <path> the project folder (default: the current folder)
|
|
48
|
+
|
|
49
|
+
Validates the pack, copies its pack content (no tooling) to
|
|
50
|
+
.pwf/packs/<id>@<version>/, pins it in
|
|
51
|
+
pwpack.json packs[] by content hash and adds { id, range: ^<major>.0.0 } to
|
|
52
|
+
requires. Only local files and folders: resolving packs from npm or a pack
|
|
53
|
+
registry is not supported.`,
|
|
54
|
+
run: (args, io) => guard('add', io, () => runAdd(args, io)),
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=add.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,WAA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ot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAOhE,wBAAsB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC/E;AAED,eAAO,MAAM,YAAY,EAAE,OAK1B,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pwf build [dir] [--out <dir>]` — assembles the app into a static pwapp on
|
|
3
|
+
* disk (default `<dir>/.pwf/out/`), ready for any static host or `pwf run`.
|
|
4
|
+
*/
|
|
5
|
+
import { isAbsolute, relative, resolve } from 'node:path';
|
|
6
|
+
import { assemblePwapp } from '../dev/assemble.js';
|
|
7
|
+
import { formatDiagnostic } from '../dev/diagnostics.js';
|
|
8
|
+
import { OutputFolderError, writePwapp } from '../dev/output.js';
|
|
9
|
+
function shown(cwd, path) {
|
|
10
|
+
const rel = relative(cwd, path);
|
|
11
|
+
return rel && !rel.startsWith('..') && !isAbsolute(rel) ? rel : path;
|
|
12
|
+
}
|
|
13
|
+
export async function runBuild(args, io) {
|
|
14
|
+
const root = resolve(io.cwd, args.positionals[0] ?? '.');
|
|
15
|
+
const outFlag = args.flags['out'];
|
|
16
|
+
if (outFlag === true || outFlag === '') {
|
|
17
|
+
io.err('pwf build: --out needs a folder');
|
|
18
|
+
return 2;
|
|
19
|
+
}
|
|
20
|
+
const out = typeof outFlag === 'string' ? resolve(io.cwd, outFlag) : resolve(root, '.pwf', 'out');
|
|
21
|
+
const result = await assemblePwapp(root);
|
|
22
|
+
for (const d of result.diagnostics) {
|
|
23
|
+
const line = formatDiagnostic(d);
|
|
24
|
+
if (d.severity === 'error')
|
|
25
|
+
io.err(line);
|
|
26
|
+
else
|
|
27
|
+
io.out(line);
|
|
28
|
+
}
|
|
29
|
+
const { stats } = result;
|
|
30
|
+
if (!result.ok) {
|
|
31
|
+
const errors = result.diagnostics.filter((d) => d.severity === 'error').length;
|
|
32
|
+
io.err(`pwf build: ${errors} error${errors === 1 ? '' : 's'}; nothing written`);
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
await writePwapp(result.files, out);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
if (e instanceof OutputFolderError) {
|
|
40
|
+
io.err(`pwf build: ${e.message}`);
|
|
41
|
+
return 1;
|
|
42
|
+
}
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
45
|
+
io.out(`built ${stats.pages} page${stats.pages === 1 ? '' : 's'}, ${stats.blocks} block type${stats.blocks === 1 ? '' : 's'}, ${stats.engines} engine${stats.engines === 1 ? '' : 's'} — ${stats.compiled}/${stats.atoms} atoms compiled (${stats.fromCache} from cache${stats.failed ? `, ${stats.failed} failed` : ''}) in ${result.ms} ms`);
|
|
46
|
+
io.out(`wrote ${result.files.size} files to ${shown(io.cwd, out)}`);
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
export const buildCommand = {
|
|
50
|
+
name: 'build',
|
|
51
|
+
summary: 'Assemble the app into a static pwapp folder',
|
|
52
|
+
usage: 'pwf build [dir] [--out <dir>]',
|
|
53
|
+
run: runBuild,
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAGhE,SAAS,KAAK,CAA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A;IACD,EAAE,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,KAAK,CAAC,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAA;IACnE,OAAO,CAAC,CAAA;AACV,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAY;IACnC,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,6CAA6C;IACtD,KAAK,EAAE,+BAA+B;IACtC,GAAG,EAAE,QAAQ;CACd,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Command, CommandIO, ParsedArgs } from './types.js';
|
|
2
|
+
/** Environment variable naming the foundation pack when `--foundation` is not given. */
|
|
3
|
+
export declare const FOUNDATION_ENV = "PWF_FOUNDATION";
|
|
4
|
+
export interface CreateOptions {
|
|
5
|
+
/** Engine version to declare a range for; defaults to the installed contracts version. */
|
|
6
|
+
readonly engineVersion?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function runCreate(args: ParsedArgs, io: CommandIO, options?: CreateOptions): Promise<number>;
|
|
9
|
+
export declare const create: Command;
|
|
10
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAkBhE,wFAAwF;AACxF,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAiB9C,MAAM,WAAW,aAAa;IAC5B,0FAA0F;IAC1F,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAChC;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgF7G;AAED,eAAO,MAAM,MAAM,EAAE,OAapB,CAAA"}
|