@ifc-lite/server-bin 1.1.8
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 +373 -0
- package/README.md +140 -0
- package/dist/binary.d.ts +35 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +267 -0
- package/dist/binary.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +125 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/platform.d.ts +20 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +93 -0
- package/dist/platform.js.map +1 -0
- package/dist/postinstall.d.ts +3 -0
- package/dist/postinstall.d.ts.map +1 -0
- package/dist/postinstall.js +45 -0
- package/dist/postinstall.js.map +1 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
Mozilla Public License Version 2.0
|
|
2
|
+
==================================
|
|
3
|
+
|
|
4
|
+
1. Definitions
|
|
5
|
+
--------------
|
|
6
|
+
|
|
7
|
+
1.1. "Contributor"
|
|
8
|
+
means each individual or legal entity that creates, contributes to
|
|
9
|
+
the creation of, or owns Covered Software.
|
|
10
|
+
|
|
11
|
+
1.2. "Contributor Version"
|
|
12
|
+
means the combination of the Contributions of others (if any) used
|
|
13
|
+
by a Contributor and that particular Contributor's Contribution.
|
|
14
|
+
|
|
15
|
+
1.3. "Contribution"
|
|
16
|
+
means Covered Software of a particular Contributor.
|
|
17
|
+
|
|
18
|
+
1.4. "Covered Software"
|
|
19
|
+
means Source Code Form to which the initial Contributor has attached
|
|
20
|
+
the notice in Exhibit A, the Executable Form of such Source Code
|
|
21
|
+
Form, and Modifications of such Source Code Form, in each case
|
|
22
|
+
including portions thereof.
|
|
23
|
+
|
|
24
|
+
1.5. "Incompatible With Secondary Licenses"
|
|
25
|
+
means
|
|
26
|
+
|
|
27
|
+
(a) that the initial Contributor has attached the notice described
|
|
28
|
+
in Exhibit B to the Covered Software; or
|
|
29
|
+
|
|
30
|
+
(b) that the Covered Software was made available under the terms of
|
|
31
|
+
version 1.1 or earlier of the License, but not also under the
|
|
32
|
+
terms of a Secondary License.
|
|
33
|
+
|
|
34
|
+
1.6. "Executable Form"
|
|
35
|
+
means any form of the work other than Source Code Form.
|
|
36
|
+
|
|
37
|
+
1.7. "Larger Work"
|
|
38
|
+
means a work that combines Covered Software with other material, in
|
|
39
|
+
a separate file or files, that is not Covered Software.
|
|
40
|
+
|
|
41
|
+
1.8. "License"
|
|
42
|
+
means this document.
|
|
43
|
+
|
|
44
|
+
1.9. "Licensable"
|
|
45
|
+
means having the right to grant, to the maximum extent possible,
|
|
46
|
+
whether at the time of the initial grant or subsequently, any and
|
|
47
|
+
all of the rights conveyed by this License.
|
|
48
|
+
|
|
49
|
+
1.10. "Modifications"
|
|
50
|
+
means any of the following:
|
|
51
|
+
|
|
52
|
+
(a) any file in Source Code Form that results from an addition to,
|
|
53
|
+
deletion from, or modification of the contents of Covered
|
|
54
|
+
Software; or
|
|
55
|
+
|
|
56
|
+
(b) any new file in Source Code Form that contains any Covered
|
|
57
|
+
Software.
|
|
58
|
+
|
|
59
|
+
1.11. "Patent Claims" of a Contributor
|
|
60
|
+
means any patent claim(s), including without limitation, method,
|
|
61
|
+
process, and apparatus claims, in any patent Licensable by such
|
|
62
|
+
Contributor that would be infringed, but for the grant of the
|
|
63
|
+
License, by the making, using, selling, offering for sale, having
|
|
64
|
+
made, import, or transfer of either its Contributions or its
|
|
65
|
+
Contributor Version.
|
|
66
|
+
|
|
67
|
+
1.12. "Secondary License"
|
|
68
|
+
means either the GNU General Public License, Version 2.0, the GNU
|
|
69
|
+
Lesser General Public License, Version 2.1, the GNU Affero General
|
|
70
|
+
Public License, Version 3.0, or any later versions of those
|
|
71
|
+
licenses.
|
|
72
|
+
|
|
73
|
+
1.13. "Source Code Form"
|
|
74
|
+
means the form of the work preferred for making modifications.
|
|
75
|
+
|
|
76
|
+
1.14. "You" (or "Your")
|
|
77
|
+
means an individual or a legal entity exercising rights under this
|
|
78
|
+
License. For legal entities, "You" includes any entity that
|
|
79
|
+
controls, is controlled by, or is under common control with You. For
|
|
80
|
+
purposes of this definition, "control" means (a) the power, direct
|
|
81
|
+
or indirect, to cause the direction or management of such entity,
|
|
82
|
+
whether by contract or otherwise, or (b) ownership of more than
|
|
83
|
+
fifty percent (50%) of the outstanding shares or beneficial
|
|
84
|
+
ownership of such entity.
|
|
85
|
+
|
|
86
|
+
2. License Grants and Conditions
|
|
87
|
+
--------------------------------
|
|
88
|
+
|
|
89
|
+
2.1. Grants
|
|
90
|
+
|
|
91
|
+
Each Contributor hereby grants You a world-wide, royalty-free,
|
|
92
|
+
non-exclusive license:
|
|
93
|
+
|
|
94
|
+
(a) under intellectual property rights (other than patent or trademark)
|
|
95
|
+
Licensable by such Contributor to use, reproduce, make available,
|
|
96
|
+
modify, display, perform, distribute, and otherwise exploit its
|
|
97
|
+
Contributions, either on an unmodified basis, with Modifications, or
|
|
98
|
+
as part of a Larger Work; and
|
|
99
|
+
|
|
100
|
+
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
|
101
|
+
for sale, have made, import, and otherwise transfer either its
|
|
102
|
+
Contributions or its Contributor Version.
|
|
103
|
+
|
|
104
|
+
2.2. Effective Date
|
|
105
|
+
|
|
106
|
+
The licenses granted in Section 2.1 with respect to any Contribution
|
|
107
|
+
become effective for each Contribution on the date the Contributor first
|
|
108
|
+
distributes such Contribution.
|
|
109
|
+
|
|
110
|
+
2.3. Limitations on Grant Scope
|
|
111
|
+
|
|
112
|
+
The licenses granted in this Section 2 are the only rights granted under
|
|
113
|
+
this License. No additional rights or licenses will be implied from the
|
|
114
|
+
distribution or licensing of Covered Software under this License.
|
|
115
|
+
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
|
116
|
+
Contributor:
|
|
117
|
+
|
|
118
|
+
(a) for any code that a Contributor has removed from Covered Software;
|
|
119
|
+
or
|
|
120
|
+
|
|
121
|
+
(b) for infringements caused by: (i) Your and any other third party's
|
|
122
|
+
modifications of Covered Software, or (ii) the combination of its
|
|
123
|
+
Contributions with other software (except as part of its Contributor
|
|
124
|
+
Version); or
|
|
125
|
+
|
|
126
|
+
(c) under Patent Claims infringed by Covered Software in the absence of
|
|
127
|
+
its Contributions.
|
|
128
|
+
|
|
129
|
+
This License does not grant any rights in the trademarks, service marks,
|
|
130
|
+
or logos of any Contributor (except as may be necessary to comply with
|
|
131
|
+
the notice requirements in Section 3.4).
|
|
132
|
+
|
|
133
|
+
2.4. Subsequent Licenses
|
|
134
|
+
|
|
135
|
+
No Contributor makes additional grants as a result of Your choice to
|
|
136
|
+
distribute the Covered Software under a subsequent version of this
|
|
137
|
+
License (see Section 10.2) or under the terms of a Secondary License (if
|
|
138
|
+
permitted under the terms of Section 3.3).
|
|
139
|
+
|
|
140
|
+
2.5. Representation
|
|
141
|
+
|
|
142
|
+
Each Contributor represents that the Contributor believes its
|
|
143
|
+
Contributions are its original creation(s) or it has sufficient rights
|
|
144
|
+
to grant the rights to its Contributions conveyed by this License.
|
|
145
|
+
|
|
146
|
+
2.6. Fair Use
|
|
147
|
+
|
|
148
|
+
This License is not intended to limit any rights You have under
|
|
149
|
+
applicable copyright doctrines of fair use, fair dealing, or other
|
|
150
|
+
equivalents.
|
|
151
|
+
|
|
152
|
+
2.7. Conditions
|
|
153
|
+
|
|
154
|
+
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
|
155
|
+
in Section 2.1.
|
|
156
|
+
|
|
157
|
+
3. Responsibilities
|
|
158
|
+
-------------------
|
|
159
|
+
|
|
160
|
+
3.1. Distribution of Source Form
|
|
161
|
+
|
|
162
|
+
All distribution of Covered Software in Source Code Form, including any
|
|
163
|
+
Modifications that You create or to which You contribute, must be under
|
|
164
|
+
the terms of this License. You must inform recipients that the Source
|
|
165
|
+
Code Form of the Covered Software is governed by the terms of this
|
|
166
|
+
License, and how they can obtain a copy of this License. You may not
|
|
167
|
+
attempt to alter or restrict the recipients' rights in the Source Code
|
|
168
|
+
Form.
|
|
169
|
+
|
|
170
|
+
3.2. Distribution of Executable Form
|
|
171
|
+
|
|
172
|
+
If You distribute Covered Software in Executable Form then:
|
|
173
|
+
|
|
174
|
+
(a) such Covered Software must also be made available in Source Code
|
|
175
|
+
Form, as described in Section 3.1, and You must inform recipients of
|
|
176
|
+
the Executable Form how they can obtain a copy of such Source Code
|
|
177
|
+
Form by reasonable means in a timely manner, at a charge no more
|
|
178
|
+
than the cost of distribution to the recipient; and
|
|
179
|
+
|
|
180
|
+
(b) You may distribute such Executable Form under the terms of this
|
|
181
|
+
License, or sublicense it under different terms, provided that the
|
|
182
|
+
license for the Executable Form does not attempt to limit or alter
|
|
183
|
+
the recipients' rights in the Source Code Form under this License.
|
|
184
|
+
|
|
185
|
+
3.3. Distribution of a Larger Work
|
|
186
|
+
|
|
187
|
+
You may create and distribute a Larger Work under terms of Your choice,
|
|
188
|
+
provided that You also comply with the requirements of this License for
|
|
189
|
+
the Covered Software. If the Larger Work is a combination of Covered
|
|
190
|
+
Software with a work governed by one or more Secondary Licenses, and the
|
|
191
|
+
Covered Software is not Incompatible With Secondary Licenses, this
|
|
192
|
+
License permits You to additionally distribute such Covered Software
|
|
193
|
+
under the terms of such Secondary License(s), so that the recipient of
|
|
194
|
+
the Larger Work may, at their option, further distribute the Covered
|
|
195
|
+
Software under the terms of either this License or such Secondary
|
|
196
|
+
License(s).
|
|
197
|
+
|
|
198
|
+
3.4. Notices
|
|
199
|
+
|
|
200
|
+
You may not remove or alter the substance of any license notices
|
|
201
|
+
(including copyright notices, patent notices, disclaimers of warranty,
|
|
202
|
+
or limitations of liability) contained within the Source Code Form of
|
|
203
|
+
the Covered Software, except that You may alter any license notices to
|
|
204
|
+
the extent required to remedy known factual inaccuracies.
|
|
205
|
+
|
|
206
|
+
3.5. Application of Additional Terms
|
|
207
|
+
|
|
208
|
+
You may choose to offer, and to charge a fee for, warranty, support,
|
|
209
|
+
indemnity or liability obligations to one or more recipients of Covered
|
|
210
|
+
Software. However, You may do so only on Your own behalf, and not on
|
|
211
|
+
behalf of any Contributor. You must make it absolutely clear that any
|
|
212
|
+
such warranty, support, indemnity, or liability obligation is offered by
|
|
213
|
+
You alone, and You hereby agree to indemnify every Contributor for any
|
|
214
|
+
liability incurred by such Contributor as a result of warranty, support,
|
|
215
|
+
indemnity or liability terms You offer. You may include additional
|
|
216
|
+
disclaimers of warranty and limitations of liability specific to any
|
|
217
|
+
jurisdiction.
|
|
218
|
+
|
|
219
|
+
4. Inability to Comply Due to Statute or Regulation
|
|
220
|
+
---------------------------------------------------
|
|
221
|
+
|
|
222
|
+
If it is impossible for You to comply with any of the terms of this
|
|
223
|
+
License with respect to some or all of the Covered Software due to
|
|
224
|
+
statute, judicial order, or regulation then You must: (a) comply with
|
|
225
|
+
the terms of this License to the maximum extent possible; and (b)
|
|
226
|
+
describe the limitations and the code they affect. Such description must
|
|
227
|
+
be placed in a text file included with all distributions of the Covered
|
|
228
|
+
Software under this License. Except to the extent prohibited by statute
|
|
229
|
+
or regulation, such description must be sufficiently detailed for a
|
|
230
|
+
recipient of ordinary skill to be able to understand it.
|
|
231
|
+
|
|
232
|
+
5. Termination
|
|
233
|
+
--------------
|
|
234
|
+
|
|
235
|
+
5.1. The rights granted under this License will terminate automatically
|
|
236
|
+
if You fail to comply with any of its terms. However, if You become
|
|
237
|
+
compliant, then the rights granted under this License from a particular
|
|
238
|
+
Contributor are reinstated (a) provisionally, unless and until such
|
|
239
|
+
Contributor explicitly and finally terminates Your grants, and (b) on an
|
|
240
|
+
ongoing basis, if such Contributor fails to notify You of the
|
|
241
|
+
non-compliance by some reasonable means prior to 60 days after You have
|
|
242
|
+
come back into compliance. Moreover, Your grants from a particular
|
|
243
|
+
Contributor are reinstated on an ongoing basis if such Contributor
|
|
244
|
+
notifies You of the non-compliance by some reasonable means, this is the
|
|
245
|
+
first time You have received notice of non-compliance with this License
|
|
246
|
+
from such Contributor, and You become compliant prior to 30 days after
|
|
247
|
+
Your receipt of the notice.
|
|
248
|
+
|
|
249
|
+
5.2. If You initiate litigation against any entity by asserting a patent
|
|
250
|
+
infringement claim (excluding declaratory judgment actions,
|
|
251
|
+
counter-claims, and cross-claims) alleging that a Contributor Version
|
|
252
|
+
directly or indirectly infringes any patent, then the rights granted to
|
|
253
|
+
You by any and all Contributors for the Covered Software under Section
|
|
254
|
+
2.1 of this License shall terminate.
|
|
255
|
+
|
|
256
|
+
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
|
257
|
+
end user license agreements (excluding distributors and resellers) which
|
|
258
|
+
have been validly granted by You or Your distributors under this License
|
|
259
|
+
prior to termination shall survive termination.
|
|
260
|
+
|
|
261
|
+
************************************************************************
|
|
262
|
+
* *
|
|
263
|
+
* 6. Disclaimer of Warranty *
|
|
264
|
+
* ------------------------- *
|
|
265
|
+
* *
|
|
266
|
+
* Covered Software is provided under this License on an "as is" *
|
|
267
|
+
* basis, without warranty of any kind, either expressed, implied, or *
|
|
268
|
+
* statutory, including, without limitation, warranties that the *
|
|
269
|
+
* Covered Software is free of defects, merchantable, fit for a *
|
|
270
|
+
* particular purpose or non-infringing. The entire risk as to the *
|
|
271
|
+
* quality and performance of the Covered Software is with You. *
|
|
272
|
+
* Should any Covered Software prove defective in any respect, You *
|
|
273
|
+
* (not any Contributor) assume the cost of any necessary servicing, *
|
|
274
|
+
* repair, or correction. This disclaimer of warranty constitutes an *
|
|
275
|
+
* essential part of this License. No use of any Covered Software is *
|
|
276
|
+
* authorized under this License except under this disclaimer. *
|
|
277
|
+
* *
|
|
278
|
+
************************************************************************
|
|
279
|
+
|
|
280
|
+
************************************************************************
|
|
281
|
+
* *
|
|
282
|
+
* 7. Limitation of Liability *
|
|
283
|
+
* -------------------------- *
|
|
284
|
+
* *
|
|
285
|
+
* Under no circumstances and under no legal theory, whether tort *
|
|
286
|
+
* (including negligence), contract, or otherwise, shall any *
|
|
287
|
+
* Contributor, or anyone who distributes Covered Software as *
|
|
288
|
+
* permitted above, be liable to You for any direct, indirect, *
|
|
289
|
+
* special, incidental, or consequential damages of any character *
|
|
290
|
+
* including, without limitation, damages for lost profits, loss of *
|
|
291
|
+
* goodwill, work stoppage, computer failure or malfunction, or any *
|
|
292
|
+
* and all other commercial damages or losses, even if such party *
|
|
293
|
+
* shall have been informed of the possibility of such damages. This *
|
|
294
|
+
* limitation of liability shall not apply to liability for death or *
|
|
295
|
+
* personal injury resulting from such party's negligence to the *
|
|
296
|
+
* extent applicable law prohibits such limitation. Some *
|
|
297
|
+
* jurisdictions do not allow the exclusion or limitation of *
|
|
298
|
+
* incidental or consequential damages, so this exclusion and *
|
|
299
|
+
* limitation may not apply to You. *
|
|
300
|
+
* *
|
|
301
|
+
************************************************************************
|
|
302
|
+
|
|
303
|
+
8. Litigation
|
|
304
|
+
-------------
|
|
305
|
+
|
|
306
|
+
Any litigation relating to this License may be brought only in the
|
|
307
|
+
courts of a jurisdiction where the defendant maintains its principal
|
|
308
|
+
place of business and such litigation shall be governed by laws of that
|
|
309
|
+
jurisdiction, without reference to its conflict-of-law provisions.
|
|
310
|
+
Nothing in this Section shall prevent a party's ability to bring
|
|
311
|
+
cross-claims or counter-claims.
|
|
312
|
+
|
|
313
|
+
9. Miscellaneous
|
|
314
|
+
----------------
|
|
315
|
+
|
|
316
|
+
This License represents the complete agreement concerning the subject
|
|
317
|
+
matter hereof. If any provision of this License is held to be
|
|
318
|
+
unenforceable, such provision shall be reformed only to the extent
|
|
319
|
+
necessary to make it enforceable. Any law or regulation which provides
|
|
320
|
+
that the language of a contract shall be construed against the drafter
|
|
321
|
+
shall not be used to construe this License against a Contributor.
|
|
322
|
+
|
|
323
|
+
10. Versions of the License
|
|
324
|
+
---------------------------
|
|
325
|
+
|
|
326
|
+
10.1. New Versions
|
|
327
|
+
|
|
328
|
+
Mozilla Foundation is the license steward. Except as provided in Section
|
|
329
|
+
10.3, no one other than the license steward has the right to modify or
|
|
330
|
+
publish new versions of this License. Each version will be given a
|
|
331
|
+
distinguishing version number.
|
|
332
|
+
|
|
333
|
+
10.2. Effect of New Versions
|
|
334
|
+
|
|
335
|
+
You may distribute the Covered Software under the terms of the version
|
|
336
|
+
of the License under which You originally received the Covered Software,
|
|
337
|
+
or under the terms of any subsequent version published by the license
|
|
338
|
+
steward.
|
|
339
|
+
|
|
340
|
+
10.3. Modified Versions
|
|
341
|
+
|
|
342
|
+
If you create software not governed by this License, and you want to
|
|
343
|
+
create a new license for such software, you may create and use a
|
|
344
|
+
modified version of this License if you rename the license and remove
|
|
345
|
+
any references to the name of the license steward (except to note that
|
|
346
|
+
such modified license differs from this License).
|
|
347
|
+
|
|
348
|
+
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
|
349
|
+
Licenses
|
|
350
|
+
|
|
351
|
+
If You choose to distribute Source Code Form that is Incompatible With
|
|
352
|
+
Secondary Licenses under the terms of this version of the License, the
|
|
353
|
+
notice described in Exhibit B of this License must be attached.
|
|
354
|
+
|
|
355
|
+
Exhibit A - Source Code Form License Notice
|
|
356
|
+
-------------------------------------------
|
|
357
|
+
|
|
358
|
+
This Source Code Form is subject to the terms of the Mozilla Public
|
|
359
|
+
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
360
|
+
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
361
|
+
|
|
362
|
+
If it is not possible or desirable to put the notice in a particular
|
|
363
|
+
file, then You may include the notice in a location (such as a LICENSE
|
|
364
|
+
file in a relevant directory) where a recipient would be likely to look
|
|
365
|
+
for such a notice.
|
|
366
|
+
|
|
367
|
+
You may add additional accurate notices of copyright ownership.
|
|
368
|
+
|
|
369
|
+
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
|
370
|
+
---------------------------------------------------------
|
|
371
|
+
|
|
372
|
+
This Source Code Form is "Incompatible With Secondary Licenses", as
|
|
373
|
+
defined by the Mozilla Public License, v. 2.0.
|
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# @ifc-lite/server-bin
|
|
2
|
+
|
|
3
|
+
Pre-built IFC-Lite server binary - run without Docker or Rust.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run directly with npx (downloads binary on first run)
|
|
9
|
+
npx @ifc-lite/server-bin
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g @ifc-lite/server-bin
|
|
13
|
+
ifc-lite-server
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- **Zero dependencies**: No Docker, Rust, or compilation required
|
|
19
|
+
- **Auto-download**: Binary is downloaded on first run
|
|
20
|
+
- **Cross-platform**: macOS, Linux, and Windows support
|
|
21
|
+
- **Fast startup**: Native binary starts instantly
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### CLI
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Start server on default port (8080)
|
|
29
|
+
npx @ifc-lite/server-bin
|
|
30
|
+
|
|
31
|
+
# Start on custom port
|
|
32
|
+
PORT=3001 npx @ifc-lite/server-bin
|
|
33
|
+
|
|
34
|
+
# Download binary without starting (for CI/CD)
|
|
35
|
+
npx @ifc-lite/server-bin download
|
|
36
|
+
|
|
37
|
+
# Show platform and binary info
|
|
38
|
+
npx @ifc-lite/server-bin info
|
|
39
|
+
|
|
40
|
+
# Show help
|
|
41
|
+
npx @ifc-lite/server-bin help
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Environment Variables
|
|
45
|
+
|
|
46
|
+
| Variable | Default | Description |
|
|
47
|
+
|----------|---------|-------------|
|
|
48
|
+
| `PORT` | 8080 | Server port |
|
|
49
|
+
| `RUST_LOG` | info | Log level: error, warn, info, debug |
|
|
50
|
+
| `MAX_FILE_SIZE_MB` | 500 | Maximum upload size |
|
|
51
|
+
| `WORKER_THREADS` | CPU cores | Parallel processing threads |
|
|
52
|
+
| `CACHE_DIR` | ./.cache | Cache directory |
|
|
53
|
+
| `REQUEST_TIMEOUT_SECS` | 300 | Request timeout |
|
|
54
|
+
| `INITIAL_BATCH_SIZE` | 100 | Streaming initial batch |
|
|
55
|
+
| `MAX_BATCH_SIZE` | 1000 | Streaming max batch |
|
|
56
|
+
| `CACHE_MAX_AGE_DAYS` | 7 | Cache retention |
|
|
57
|
+
|
|
58
|
+
### Programmatic Usage
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { runBinary, ensureBinary, getBinaryInfo } from '@ifc-lite/server-bin';
|
|
62
|
+
|
|
63
|
+
// Get binary info
|
|
64
|
+
const info = getBinaryInfo();
|
|
65
|
+
console.log(`Platform: ${info.platform.targetTriple}`);
|
|
66
|
+
console.log(`Cached: ${info.isCached}`);
|
|
67
|
+
|
|
68
|
+
// Ensure binary is downloaded
|
|
69
|
+
const binaryPath = await ensureBinary();
|
|
70
|
+
|
|
71
|
+
// Run the server with custom args
|
|
72
|
+
const exitCode = await runBinary(['--help']);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Supported Platforms
|
|
76
|
+
|
|
77
|
+
| Platform | Architecture | Status |
|
|
78
|
+
|----------|--------------|--------|
|
|
79
|
+
| macOS | x64 (Intel) | ✅ |
|
|
80
|
+
| macOS | arm64 (Apple Silicon) | ✅ |
|
|
81
|
+
| Linux | x64 (glibc) | ✅ |
|
|
82
|
+
| Linux | arm64 (glibc) | ✅ |
|
|
83
|
+
| Linux | x64 (musl/Alpine) | ✅ |
|
|
84
|
+
| Windows | x64 | ✅ |
|
|
85
|
+
|
|
86
|
+
## Skipping Auto-Download
|
|
87
|
+
|
|
88
|
+
To skip the automatic binary download during `npm install`:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
IFC_LITE_SKIP_DOWNLOAD=1 npm install @ifc-lite/server-bin
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
You can then download manually when needed:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npx @ifc-lite/server-bin download
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Alternatives
|
|
101
|
+
|
|
102
|
+
If pre-built binaries don't work for your platform:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Use Docker
|
|
106
|
+
npx create-ifc-lite my-app --template server
|
|
107
|
+
cd my-app
|
|
108
|
+
docker compose up -d
|
|
109
|
+
|
|
110
|
+
# Or build from source
|
|
111
|
+
git clone https://github.com/louistrue/ifc-lite
|
|
112
|
+
cd ifc-lite/apps/server
|
|
113
|
+
cargo build --release
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## API Reference
|
|
117
|
+
|
|
118
|
+
### `runBinary(args?: string[]): Promise<number>`
|
|
119
|
+
|
|
120
|
+
Run the server binary with optional arguments. Returns exit code.
|
|
121
|
+
|
|
122
|
+
### `ensureBinary(onProgress?: ProgressCallback): Promise<string>`
|
|
123
|
+
|
|
124
|
+
Ensure binary is downloaded, returns path to binary.
|
|
125
|
+
|
|
126
|
+
### `downloadBinary(onProgress?: ProgressCallback): Promise<string>`
|
|
127
|
+
|
|
128
|
+
Force download binary, returns path.
|
|
129
|
+
|
|
130
|
+
### `getBinaryInfo(): BinaryInfo`
|
|
131
|
+
|
|
132
|
+
Get information about the binary and current platform.
|
|
133
|
+
|
|
134
|
+
### `isBinaryCached(): Promise<boolean>`
|
|
135
|
+
|
|
136
|
+
Check if binary is already downloaded.
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
[Mozilla Public License 2.0](https://mozilla.org/MPL/2.0/)
|
package/dist/binary.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type PlatformInfo } from './platform.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the path to the cached binary.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getBinaryPath(platformInfo?: PlatformInfo): string;
|
|
6
|
+
/**
|
|
7
|
+
* Check if binary exists and is the correct version.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isBinaryCached(): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Download progress callback type.
|
|
12
|
+
*/
|
|
13
|
+
export type ProgressCallback = (downloaded: number, total: number) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Download and cache the binary for the current platform.
|
|
16
|
+
*/
|
|
17
|
+
export declare function downloadBinary(onProgress?: ProgressCallback): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* Ensure binary is available, downloading if necessary.
|
|
20
|
+
*/
|
|
21
|
+
export declare function ensureBinary(onProgress?: ProgressCallback): Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Run the binary with the given arguments.
|
|
24
|
+
*/
|
|
25
|
+
export declare function runBinary(args?: string[]): Promise<number>;
|
|
26
|
+
/**
|
|
27
|
+
* Get binary info without downloading.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getBinaryInfo(): {
|
|
30
|
+
platform: PlatformInfo;
|
|
31
|
+
binaryPath: string;
|
|
32
|
+
cacheDir: string;
|
|
33
|
+
isCached: boolean;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=binary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAiBA,OAAO,EAA2C,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAyB3F;;GAEG;AACH,wBAAgB,aAAa,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,MAAM,CAGjE;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC,CAmBvD;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;AAkG3E;;GAEG;AACH,wBAAsB,cAAc,CAAC,UAAU,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmFnF;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,UAAU,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjF;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAsCpE;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI;IAC/B,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB,CASA"}
|
package/dist/binary.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/**
|
|
5
|
+
* Binary download, caching, and execution.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, mkdirSync, chmodSync, unlinkSync } from 'fs';
|
|
8
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
9
|
+
import { join, dirname } from 'path';
|
|
10
|
+
import { spawn } from 'child_process';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
import { extract } from 'tar';
|
|
13
|
+
import { execSync } from 'child_process';
|
|
14
|
+
import { getPlatformInfo, getPlatformDescription } from './platform.js';
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
// GitHub release URL pattern
|
|
17
|
+
const GITHUB_REPO = 'louistrue/ifc-lite';
|
|
18
|
+
const RELEASE_BASE_URL = `https://github.com/${GITHUB_REPO}/releases/download`;
|
|
19
|
+
// Cache directory (inside the package for portability)
|
|
20
|
+
const CACHE_DIR = join(__dirname, '..', '.cache');
|
|
21
|
+
const VERSION_FILE = join(CACHE_DIR, 'version.txt');
|
|
22
|
+
/**
|
|
23
|
+
* Get the current package version.
|
|
24
|
+
*/
|
|
25
|
+
async function getPackageVersion() {
|
|
26
|
+
try {
|
|
27
|
+
const pkgPath = join(__dirname, '..', 'package.json');
|
|
28
|
+
const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));
|
|
29
|
+
return pkg.version;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return 'unknown';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get the path to the cached binary.
|
|
37
|
+
*/
|
|
38
|
+
export function getBinaryPath(platformInfo) {
|
|
39
|
+
const info = platformInfo ?? getPlatformInfo();
|
|
40
|
+
return join(CACHE_DIR, info.binaryName);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check if binary exists and is the correct version.
|
|
44
|
+
*/
|
|
45
|
+
export async function isBinaryCached() {
|
|
46
|
+
const binaryPath = getBinaryPath();
|
|
47
|
+
if (!existsSync(binaryPath)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
// Check version file
|
|
51
|
+
if (!existsSync(VERSION_FILE)) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const cachedVersion = (await readFile(VERSION_FILE, 'utf-8')).trim();
|
|
56
|
+
const currentVersion = await getPackageVersion();
|
|
57
|
+
return cachedVersion === currentVersion;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Download file with progress reporting.
|
|
65
|
+
*/
|
|
66
|
+
async function downloadFile(url, destPath, onProgress) {
|
|
67
|
+
const response = await fetch(url, {
|
|
68
|
+
headers: {
|
|
69
|
+
'User-Agent': 'ifc-lite-server-bin',
|
|
70
|
+
},
|
|
71
|
+
redirect: 'follow',
|
|
72
|
+
});
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
throw new Error(`Download failed: ${response.status} ${response.statusText}`);
|
|
75
|
+
}
|
|
76
|
+
const contentLength = response.headers.get('content-length');
|
|
77
|
+
const total = contentLength ? parseInt(contentLength, 10) : 0;
|
|
78
|
+
let downloaded = 0;
|
|
79
|
+
const reader = response.body?.getReader();
|
|
80
|
+
if (!reader) {
|
|
81
|
+
throw new Error('No response body');
|
|
82
|
+
}
|
|
83
|
+
// Ensure directory exists
|
|
84
|
+
mkdirSync(dirname(destPath), { recursive: true });
|
|
85
|
+
const chunks = [];
|
|
86
|
+
while (true) {
|
|
87
|
+
const { done, value } = await reader.read();
|
|
88
|
+
if (done)
|
|
89
|
+
break;
|
|
90
|
+
chunks.push(value);
|
|
91
|
+
downloaded += value.length;
|
|
92
|
+
if (onProgress && total > 0) {
|
|
93
|
+
onProgress(downloaded, total);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Write all chunks to file
|
|
97
|
+
const buffer = Buffer.concat(chunks);
|
|
98
|
+
await writeFile(destPath, buffer);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Extract tar.gz archive.
|
|
102
|
+
*/
|
|
103
|
+
async function extractTarGz(archivePath, destDir) {
|
|
104
|
+
mkdirSync(destDir, { recursive: true });
|
|
105
|
+
await extract({
|
|
106
|
+
file: archivePath,
|
|
107
|
+
cwd: destDir,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Extract zip archive (Windows).
|
|
112
|
+
* Uses PowerShell on Windows, unzip on Unix (fallback).
|
|
113
|
+
*/
|
|
114
|
+
async function extractZip(archivePath, destDir) {
|
|
115
|
+
mkdirSync(destDir, { recursive: true });
|
|
116
|
+
if (process.platform === 'win32') {
|
|
117
|
+
// Use PowerShell on Windows
|
|
118
|
+
execSync(`powershell -Command "Expand-Archive -Path '${archivePath}' -DestinationPath '${destDir}' -Force"`, { stdio: 'pipe' });
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// Use unzip on Unix (fallback, shouldn't normally be needed)
|
|
122
|
+
execSync(`unzip -o "${archivePath}" -d "${destDir}"`, { stdio: 'pipe' });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Extract archive based on type.
|
|
127
|
+
*/
|
|
128
|
+
async function extractArchive(archivePath, destDir, archiveType) {
|
|
129
|
+
if (archiveType === 'zip') {
|
|
130
|
+
await extractZip(archivePath, destDir);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
await extractTarGz(archivePath, destDir);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Download and cache the binary for the current platform.
|
|
138
|
+
*/
|
|
139
|
+
export async function downloadBinary(onProgress) {
|
|
140
|
+
const platformInfo = getPlatformInfo();
|
|
141
|
+
const version = await getPackageVersion();
|
|
142
|
+
console.log(`Downloading IFC-Lite server for ${getPlatformDescription(platformInfo)}...`);
|
|
143
|
+
console.log(`Version: ${version}`);
|
|
144
|
+
// Construct download URL
|
|
145
|
+
const downloadUrl = `${RELEASE_BASE_URL}/v${version}/${platformInfo.archiveName}`;
|
|
146
|
+
const archivePath = join(CACHE_DIR, platformInfo.archiveName);
|
|
147
|
+
const binaryPath = getBinaryPath(platformInfo);
|
|
148
|
+
// Clean up any existing files
|
|
149
|
+
if (existsSync(archivePath)) {
|
|
150
|
+
unlinkSync(archivePath);
|
|
151
|
+
}
|
|
152
|
+
// Download archive
|
|
153
|
+
console.log(`Downloading from: ${downloadUrl}`);
|
|
154
|
+
try {
|
|
155
|
+
await downloadFile(downloadUrl, archivePath, onProgress);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
// Try alternate URL patterns
|
|
159
|
+
const altUrls = [
|
|
160
|
+
`${RELEASE_BASE_URL}/server-v${version}/${platformInfo.archiveName}`,
|
|
161
|
+
`${RELEASE_BASE_URL}/${version}/${platformInfo.archiveName}`,
|
|
162
|
+
];
|
|
163
|
+
let downloaded = false;
|
|
164
|
+
for (const altUrl of altUrls) {
|
|
165
|
+
try {
|
|
166
|
+
console.log(`Trying alternate URL: ${altUrl}`);
|
|
167
|
+
await downloadFile(altUrl, archivePath, onProgress);
|
|
168
|
+
downloaded = true;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (!downloaded) {
|
|
176
|
+
throw new Error(`Failed to download binary from GitHub releases.\n` +
|
|
177
|
+
`URL: ${downloadUrl}\n` +
|
|
178
|
+
`Error: ${error instanceof Error ? error.message : String(error)}\n\n` +
|
|
179
|
+
`This could mean:\n` +
|
|
180
|
+
` 1. The release doesn't exist yet for version ${version}\n` +
|
|
181
|
+
` 2. Pre-built binaries aren't available for ${platformInfo.targetTriple}\n` +
|
|
182
|
+
` 3. Network connectivity issues\n\n` +
|
|
183
|
+
`Alternatives:\n` +
|
|
184
|
+
` - Use Docker: npx create-ifc-lite my-app --template server\n` +
|
|
185
|
+
` - Build from source: cargo build --release -p ifc-lite-server`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
console.log('Extracting archive...');
|
|
189
|
+
// Extract archive based on type
|
|
190
|
+
await extractArchive(archivePath, CACHE_DIR, platformInfo.archiveType);
|
|
191
|
+
// Make binary executable (Unix only)
|
|
192
|
+
if (platformInfo.platform !== 'win32') {
|
|
193
|
+
chmodSync(binaryPath, 0o755);
|
|
194
|
+
}
|
|
195
|
+
// Verify binary exists
|
|
196
|
+
if (!existsSync(binaryPath)) {
|
|
197
|
+
throw new Error(`Binary not found after extraction: ${binaryPath}\n` +
|
|
198
|
+
`Archive may have unexpected structure.`);
|
|
199
|
+
}
|
|
200
|
+
// Write version file
|
|
201
|
+
await writeFile(VERSION_FILE, version);
|
|
202
|
+
// Clean up archive
|
|
203
|
+
unlinkSync(archivePath);
|
|
204
|
+
console.log(`Binary installed at: ${binaryPath}`);
|
|
205
|
+
return binaryPath;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Ensure binary is available, downloading if necessary.
|
|
209
|
+
*/
|
|
210
|
+
export async function ensureBinary(onProgress) {
|
|
211
|
+
if (await isBinaryCached()) {
|
|
212
|
+
return getBinaryPath();
|
|
213
|
+
}
|
|
214
|
+
return downloadBinary(onProgress);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Run the binary with the given arguments.
|
|
218
|
+
*/
|
|
219
|
+
export async function runBinary(args = []) {
|
|
220
|
+
const binaryPath = await ensureBinary((downloaded, total) => {
|
|
221
|
+
const percent = Math.round((downloaded / total) * 100);
|
|
222
|
+
process.stdout.write(`\rDownloading: ${percent}%`);
|
|
223
|
+
if (downloaded === total) {
|
|
224
|
+
console.log(''); // New line after progress
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
return new Promise((resolve, reject) => {
|
|
228
|
+
const options = {
|
|
229
|
+
stdio: 'inherit',
|
|
230
|
+
env: process.env,
|
|
231
|
+
};
|
|
232
|
+
const child = spawn(binaryPath, args, options);
|
|
233
|
+
child.on('error', (error) => {
|
|
234
|
+
reject(new Error(`Failed to start server: ${error.message}`));
|
|
235
|
+
});
|
|
236
|
+
child.on('exit', (code, signal) => {
|
|
237
|
+
if (signal) {
|
|
238
|
+
// Process was killed by a signal
|
|
239
|
+
resolve(128 + (signal === 'SIGINT' ? 2 : signal === 'SIGTERM' ? 15 : 1));
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
resolve(code ?? 0);
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
// Forward signals to child process
|
|
246
|
+
const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
|
|
247
|
+
for (const sig of signals) {
|
|
248
|
+
process.on(sig, () => {
|
|
249
|
+
child.kill(sig);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Get binary info without downloading.
|
|
256
|
+
*/
|
|
257
|
+
export function getBinaryInfo() {
|
|
258
|
+
const platform = getPlatformInfo();
|
|
259
|
+
const binaryPath = getBinaryPath(platform);
|
|
260
|
+
return {
|
|
261
|
+
platform,
|
|
262
|
+
binaryPath,
|
|
263
|
+
cacheDir: CACHE_DIR,
|
|
264
|
+
isCached: existsSync(binaryPath) && existsSync(VERSION_FILE),
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=binary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.js","sourceRoot":"","sources":["../src/binary.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D;;GAEG;AAEH,OAAO,EAAqB,UAAU,EAAE,SAAS,EAAE,SAAS,EAAY,UAAU,EAAoB,MAAM,IAAI,CAAC;AACjH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGrC,OAAO,EAAE,KAAK,EAAqB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAqB,MAAM,eAAe,CAAC;AAE3F,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE1D,6BAA6B;AAC7B,MAAM,WAAW,GAAG,oBAAoB,CAAC;AACzC,MAAM,gBAAgB,GAAG,sBAAsB,WAAW,oBAAoB,CAAC;AAE/E,uDAAuD;AACvD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;AAClD,MAAM,YAAY,GAAG,IAAI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N,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;YACrB,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,mCAAmC;QACnC,MAAM,OAAO,GAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAClE,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;YAC1B,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE;gBACnB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IAM3B,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC;IACnC,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC3C,OAAO;QACL,QAAQ;QACR,UAAU;QACV,QAAQ,EAAE,SAAS;QACnB,QAAQ,EAAE,UAAU,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
/**
|
|
6
|
+
* IFC-Lite Server Binary CLI
|
|
7
|
+
*
|
|
8
|
+
* Downloads and runs the pre-built IFC-Lite server binary.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* npx @ifc-lite/server-bin [options]
|
|
12
|
+
* npx ifc-lite-server [options]
|
|
13
|
+
*
|
|
14
|
+
* Environment variables are passed through to the server.
|
|
15
|
+
* See: https://github.com/louistrue/ifc-lite/tree/main/apps/server
|
|
16
|
+
*/
|
|
17
|
+
import { runBinary, getBinaryInfo, downloadBinary } from './binary.js';
|
|
18
|
+
import { getPlatformDescription } from './platform.js';
|
|
19
|
+
const HELP_TEXT = `
|
|
20
|
+
IFC-Lite Server - Pre-built Binary Runner
|
|
21
|
+
|
|
22
|
+
Usage:
|
|
23
|
+
npx @ifc-lite/server-bin [command] [options]
|
|
24
|
+
npx ifc-lite-server [command] [options]
|
|
25
|
+
|
|
26
|
+
Commands:
|
|
27
|
+
start Start the server (default)
|
|
28
|
+
download Download binary without starting
|
|
29
|
+
info Show binary and platform info
|
|
30
|
+
help Show this help message
|
|
31
|
+
|
|
32
|
+
Environment Variables:
|
|
33
|
+
PORT Server port (default: 8080)
|
|
34
|
+
RUST_LOG Log level: error, warn, info, debug (default: info)
|
|
35
|
+
MAX_FILE_SIZE_MB Max upload size in MB (default: 500)
|
|
36
|
+
WORKER_THREADS Parallel processing threads (default: CPU cores)
|
|
37
|
+
CACHE_DIR Cache directory (default: ./.cache)
|
|
38
|
+
REQUEST_TIMEOUT_SECS Request timeout (default: 300)
|
|
39
|
+
INITIAL_BATCH_SIZE Streaming initial batch (default: 100)
|
|
40
|
+
MAX_BATCH_SIZE Streaming max batch (default: 1000)
|
|
41
|
+
CACHE_MAX_AGE_DAYS Cache retention days (default: 7)
|
|
42
|
+
|
|
43
|
+
Examples:
|
|
44
|
+
# Start server on default port
|
|
45
|
+
npx @ifc-lite/server-bin
|
|
46
|
+
|
|
47
|
+
# Start on custom port
|
|
48
|
+
PORT=3001 npx @ifc-lite/server-bin
|
|
49
|
+
|
|
50
|
+
# Download binary only (for CI/CD)
|
|
51
|
+
npx @ifc-lite/server-bin download
|
|
52
|
+
|
|
53
|
+
# Show platform info
|
|
54
|
+
npx @ifc-lite/server-bin info
|
|
55
|
+
|
|
56
|
+
Documentation:
|
|
57
|
+
https://github.com/louistrue/ifc-lite
|
|
58
|
+
|
|
59
|
+
Alternatives:
|
|
60
|
+
- Docker: npx create-ifc-lite my-app --template server
|
|
61
|
+
- From source: cargo run --release -p ifc-lite-server
|
|
62
|
+
`;
|
|
63
|
+
async function main() {
|
|
64
|
+
const args = process.argv.slice(2);
|
|
65
|
+
const command = args[0] || 'start';
|
|
66
|
+
try {
|
|
67
|
+
switch (command) {
|
|
68
|
+
case 'help':
|
|
69
|
+
case '--help':
|
|
70
|
+
case '-h':
|
|
71
|
+
console.log(HELP_TEXT);
|
|
72
|
+
process.exit(0);
|
|
73
|
+
break;
|
|
74
|
+
case 'version':
|
|
75
|
+
case '--version':
|
|
76
|
+
case '-v': {
|
|
77
|
+
const info = getBinaryInfo();
|
|
78
|
+
const pkg = await import('../package.json', { assert: { type: 'json' } });
|
|
79
|
+
console.log(`@ifc-lite/server-bin v${pkg.default.version}`);
|
|
80
|
+
process.exit(0);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case 'info': {
|
|
84
|
+
const info = getBinaryInfo();
|
|
85
|
+
console.log('\nIFC-Lite Server Binary Info\n');
|
|
86
|
+
console.log(`Platform: ${getPlatformDescription(info.platform)}`);
|
|
87
|
+
console.log(`Target: ${info.platform.targetTriple}`);
|
|
88
|
+
console.log(`Binary name: ${info.platform.binaryName}`);
|
|
89
|
+
console.log(`Binary path: ${info.binaryPath}`);
|
|
90
|
+
console.log(`Cache dir: ${info.cacheDir}`);
|
|
91
|
+
console.log(`Cached: ${info.isCached ? 'Yes' : 'No'}`);
|
|
92
|
+
console.log('');
|
|
93
|
+
process.exit(0);
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case 'download': {
|
|
97
|
+
console.log('\nDownloading IFC-Lite server binary...\n');
|
|
98
|
+
await downloadBinary((downloaded, total) => {
|
|
99
|
+
const percent = Math.round((downloaded / total) * 100);
|
|
100
|
+
const mb = (downloaded / 1024 / 1024).toFixed(1);
|
|
101
|
+
const totalMb = (total / 1024 / 1024).toFixed(1);
|
|
102
|
+
process.stdout.write(`\rProgress: ${percent}% (${mb}/${totalMb} MB)`);
|
|
103
|
+
});
|
|
104
|
+
console.log('\n\nDownload complete!');
|
|
105
|
+
process.exit(0);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case 'start':
|
|
109
|
+
default: {
|
|
110
|
+
// Filter out 'start' command from args if present
|
|
111
|
+
const serverArgs = command === 'start' ? args.slice(1) : args;
|
|
112
|
+
console.log('\nStarting IFC-Lite server...\n');
|
|
113
|
+
const exitCode = await runBinary(serverArgs);
|
|
114
|
+
process.exit(exitCode);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.error('\nError:', error instanceof Error ? error.message : String(error));
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
main();
|
|
125
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAgB,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CjB,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC;IAEnC,IAAI,CAAC;QACH,QAAQ,OAAO,EAAE,CAAC;YAChB,KAA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B,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ifc-lite/server-bin
|
|
3
|
+
*
|
|
4
|
+
* Pre-built IFC-Lite server binary - run without Docker or Rust.
|
|
5
|
+
*
|
|
6
|
+
* CLI Usage:
|
|
7
|
+
* npx @ifc-lite/server-bin
|
|
8
|
+
* npx ifc-lite-server
|
|
9
|
+
*
|
|
10
|
+
* Programmatic Usage:
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { runBinary, ensureBinary, getBinaryInfo } from '@ifc-lite/server-bin';
|
|
13
|
+
*
|
|
14
|
+
* // Get binary info
|
|
15
|
+
* const info = getBinaryInfo();
|
|
16
|
+
* console.log(`Platform: ${info.platform.targetTriple}`);
|
|
17
|
+
* console.log(`Cached: ${info.isCached}`);
|
|
18
|
+
*
|
|
19
|
+
* // Ensure binary is downloaded
|
|
20
|
+
* const binaryPath = await ensureBinary();
|
|
21
|
+
*
|
|
22
|
+
* // Run the server
|
|
23
|
+
* const exitCode = await runBinary(['--help']);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export { runBinary, ensureBinary, downloadBinary, getBinaryPath, getBinaryInfo, isBinaryCached, type ProgressCallback, } from './binary.js';
|
|
27
|
+
export { getPlatformInfo, getPlatformDescription, type Platform, type Arch, type PlatformInfo, } from './platform.js';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,KAAK,gBAAgB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,KAAK,QAAQ,EACb,KAAK,IAAI,EACT,KAAK,YAAY,GAClB,MAAM,eAAe,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/**
|
|
5
|
+
* @ifc-lite/server-bin
|
|
6
|
+
*
|
|
7
|
+
* Pre-built IFC-Lite server binary - run without Docker or Rust.
|
|
8
|
+
*
|
|
9
|
+
* CLI Usage:
|
|
10
|
+
* npx @ifc-lite/server-bin
|
|
11
|
+
* npx ifc-lite-server
|
|
12
|
+
*
|
|
13
|
+
* Programmatic Usage:
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import { runBinary, ensureBinary, getBinaryInfo } from '@ifc-lite/server-bin';
|
|
16
|
+
*
|
|
17
|
+
* // Get binary info
|
|
18
|
+
* const info = getBinaryInfo();
|
|
19
|
+
* console.log(`Platform: ${info.platform.targetTriple}`);
|
|
20
|
+
* console.log(`Cached: ${info.isCached}`);
|
|
21
|
+
*
|
|
22
|
+
* // Ensure binary is downloaded
|
|
23
|
+
* const binaryPath = await ensureBinary();
|
|
24
|
+
*
|
|
25
|
+
* // Run the server
|
|
26
|
+
* const exitCode = await runBinary(['--help']);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export { runBinary, ensureBinary, downloadBinary, getBinaryPath, getBinaryInfo, isBinaryCached, } from './binary.js';
|
|
30
|
+
export { getPlatformInfo, getPlatformDescription, } from './platform.js';
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,GAEf,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,eAAe,EACf,sBAAsB,GAIvB,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type Platform = 'darwin' | 'linux' | 'win32';
|
|
2
|
+
export type Arch = 'x64' | 'arm64';
|
|
3
|
+
export interface PlatformInfo {
|
|
4
|
+
platform: Platform;
|
|
5
|
+
arch: Arch;
|
|
6
|
+
binaryName: string;
|
|
7
|
+
archiveName: string;
|
|
8
|
+
archiveType: 'tar.gz' | 'zip';
|
|
9
|
+
targetTriple: string;
|
|
10
|
+
isMusl: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get current platform information.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPlatformInfo(): PlatformInfo;
|
|
16
|
+
/**
|
|
17
|
+
* Get a human-readable platform description.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getPlatformDescription(info: PlatformInfo): string;
|
|
20
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAWA,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AACpD,MAAM,MAAM,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;AAEnC,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAgCD;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAkD9C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,GAAG,MAAM,CAcjE"}
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
2
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
4
|
+
/**
|
|
5
|
+
* Platform detection for binary downloads.
|
|
6
|
+
*/
|
|
7
|
+
import { execSync } from 'child_process';
|
|
8
|
+
import process from 'process';
|
|
9
|
+
/**
|
|
10
|
+
* Supported platform/arch combinations.
|
|
11
|
+
*/
|
|
12
|
+
const SUPPORTED_TARGETS = new Set([
|
|
13
|
+
'darwin-x64',
|
|
14
|
+
'darwin-arm64',
|
|
15
|
+
'linux-x64',
|
|
16
|
+
'linux-arm64',
|
|
17
|
+
'linux-x64-musl',
|
|
18
|
+
'win32-x64',
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* Detect if running on musl-based Linux (Alpine, etc.)
|
|
22
|
+
*/
|
|
23
|
+
function isMuslLinux() {
|
|
24
|
+
if (process.platform !== 'linux') {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
// Check if we're in an Alpine container or musl-based system
|
|
29
|
+
const result = execSync('ldd --version 2>&1 || true', { encoding: 'utf-8' });
|
|
30
|
+
return result.toLowerCase().includes('musl');
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// If we can't determine, assume glibc
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get current platform information.
|
|
39
|
+
*/
|
|
40
|
+
export function getPlatformInfo() {
|
|
41
|
+
const platform = process.platform;
|
|
42
|
+
const arch = process.arch;
|
|
43
|
+
// Validate platform
|
|
44
|
+
if (!['darwin', 'linux', 'win32'].includes(platform)) {
|
|
45
|
+
throw new Error(`Unsupported platform: ${platform}. ` +
|
|
46
|
+
`Supported platforms: macOS (darwin), Linux, Windows (win32)`);
|
|
47
|
+
}
|
|
48
|
+
// Validate architecture
|
|
49
|
+
if (!['x64', 'arm64'].includes(arch)) {
|
|
50
|
+
throw new Error(`Unsupported architecture: ${arch}. ` +
|
|
51
|
+
`Supported architectures: x64 (Intel/AMD), arm64 (Apple Silicon, ARM)`);
|
|
52
|
+
}
|
|
53
|
+
// Check for musl on Linux
|
|
54
|
+
const isMusl = platform === 'linux' && isMuslLinux();
|
|
55
|
+
// Build target string
|
|
56
|
+
const targetSuffix = isMusl ? '-musl' : '';
|
|
57
|
+
const targetTriple = `${platform}-${arch}${targetSuffix}`;
|
|
58
|
+
if (!SUPPORTED_TARGETS.has(targetTriple)) {
|
|
59
|
+
throw new Error(`Unsupported platform/architecture combination: ${targetTriple}. ` +
|
|
60
|
+
`Supported targets: ${Array.from(SUPPORTED_TARGETS).join(', ')}`);
|
|
61
|
+
}
|
|
62
|
+
// Binary name varies by platform
|
|
63
|
+
const binaryName = platform === 'win32' ? 'ifc-lite-server.exe' : 'ifc-lite-server';
|
|
64
|
+
// Archive type and name for downloads (Windows uses zip, others use tar.gz)
|
|
65
|
+
const archiveType = platform === 'win32' ? 'zip' : 'tar.gz';
|
|
66
|
+
const archiveName = `ifc-lite-server-${targetTriple}.${archiveType}`;
|
|
67
|
+
return {
|
|
68
|
+
platform,
|
|
69
|
+
arch,
|
|
70
|
+
binaryName,
|
|
71
|
+
archiveName,
|
|
72
|
+
archiveType,
|
|
73
|
+
targetTriple,
|
|
74
|
+
isMusl,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get a human-readable platform description.
|
|
79
|
+
*/
|
|
80
|
+
export function getPlatformDescription(info) {
|
|
81
|
+
const platformNames = {
|
|
82
|
+
darwin: 'macOS',
|
|
83
|
+
linux: 'Linux',
|
|
84
|
+
win32: 'Windows',
|
|
85
|
+
};
|
|
86
|
+
const archNames = {
|
|
87
|
+
x64: 'x64 (Intel/AMD)',
|
|
88
|
+
arm64: 'ARM64 (Apple Silicon/ARM)',
|
|
89
|
+
};
|
|
90
|
+
const muslSuffix = info.isMusl ? ' (musl/Alpine)' : '';
|
|
91
|
+
return `${platformNames[info.platform]} ${archNames[info.arch]}${muslSuffix}`;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=platform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,sEAAsE;AACtE,4DAA4D;AAE5D;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,OAAO,MAAM,SAAS,CAAC;AAe9B;;GAEG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,YAAY;IACZ,cAAc;IACd,WAAW;IACX,aAAa;IACb,gBAAgB;IAChB,WAAW;CACZ,CAAC,CAAC;AAEH;;GAEG;AACH,SAAS,WAAW;IAClB,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,6DAA6D;QAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,4BAA4B,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7E,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,M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C,iBAAiB,CAAC;IAEpF,4EAA4E;IAC5E,MAAM,WAAW,GAAG,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5D,MAAM,WAAW,GAAG,mBAAmB,YAAY,IAAI,WAAW,EAAE,CAAC;IAErE,OAAO;QACL,QAAQ;QACR,IAAI;QACJ,UAAU;QACV,WAAW;QACX,WAAW;QACX,YAAY;QACZ,MAAM;KACP,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAkB;IACvD,MAAM,aAAa,GAA6B;QAC9C,MAAM,EAAE,OAAO;QACf,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,SAAS;KACjB,CAAC;IAEF,MAAM,SAAS,GAAyB;QACtC,GAAG,EAAE,iBAAiB;QACtB,KAAK,EAAE,2BAA2B;KACnC,CAAC;IAEF,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,UAAU,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
3
|
+
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
4
|
+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
5
|
+
/**
|
|
6
|
+
* Postinstall script - downloads binary during npm install.
|
|
7
|
+
*
|
|
8
|
+
* This is optional and runs with "|| true" to not fail installation
|
|
9
|
+
* if download fails. Users can manually download later with:
|
|
10
|
+
* npx @ifc-lite/server-bin download
|
|
11
|
+
*/
|
|
12
|
+
import { downloadBinary, isBinaryCached } from './binary.js';
|
|
13
|
+
import { getPlatformInfo, getPlatformDescription } from './platform.js';
|
|
14
|
+
async function main() {
|
|
15
|
+
// Skip if IFC_LITE_SKIP_DOWNLOAD is set
|
|
16
|
+
if (process.env.IFC_LITE_SKIP_DOWNLOAD) {
|
|
17
|
+
console.log('[ifc-lite-server] Skipping binary download (IFC_LITE_SKIP_DOWNLOAD is set)');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Skip if already cached
|
|
21
|
+
if (await isBinaryCached()) {
|
|
22
|
+
console.log('[ifc-lite-server] Binary already cached, skipping download');
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const platformInfo = getPlatformInfo();
|
|
27
|
+
console.log(`[ifc-lite-server] Downloading binary for ${getPlatformDescription(platformInfo)}...`);
|
|
28
|
+
await downloadBinary((downloaded, total) => {
|
|
29
|
+
if (total > 0) {
|
|
30
|
+
const percent = Math.round((downloaded / total) * 100);
|
|
31
|
+
process.stdout.write(`\r[ifc-lite-server] Downloading: ${percent}%`);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
console.log('\n[ifc-lite-server] Binary downloaded successfully!');
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
// Don't fail installation, just warn
|
|
38
|
+
console.warn(`\n[ifc-lite-server] Warning: Failed to download binary.\n` +
|
|
39
|
+
`Error: ${error instanceof Error ? error.message : String(error)}\n` +
|
|
40
|
+
`You can download manually later with: npx @ifc-lite/server-bin download\n` +
|
|
41
|
+
`Or use Docker: npx create-ifc-lite my-app --template server`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
main();
|
|
45
|
+
//# sourceMappingURL=postinstall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"m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AA6D,CAC9D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ifc-lite/server-bin",
|
|
3
|
+
"version": "1.1.8",
|
|
4
|
+
"description": "Pre-built IFC-Lite server binary - run without Docker or Rust",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"ifc-lite-server": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"tar": "^7.0.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^20.0.0",
|
|
26
|
+
"typescript": "^5.3.0"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18.0.0"
|
|
30
|
+
},
|
|
31
|
+
"os": [
|
|
32
|
+
"darwin",
|
|
33
|
+
"linux",
|
|
34
|
+
"win32"
|
|
35
|
+
],
|
|
36
|
+
"cpu": [
|
|
37
|
+
"x64",
|
|
38
|
+
"arm64"
|
|
39
|
+
],
|
|
40
|
+
"license": "MPL-2.0",
|
|
41
|
+
"author": "Louis True",
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/louistrue/ifc-lite.git",
|
|
45
|
+
"directory": "packages/server-bin"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://louistrue.github.io/ifc-lite/",
|
|
48
|
+
"bugs": "https://github.com/louistrue/ifc-lite/issues",
|
|
49
|
+
"keywords": [
|
|
50
|
+
"ifc",
|
|
51
|
+
"bim",
|
|
52
|
+
"server",
|
|
53
|
+
"binary",
|
|
54
|
+
"cli",
|
|
55
|
+
"aec"
|
|
56
|
+
],
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc",
|
|
62
|
+
"dev": "tsc --watch",
|
|
63
|
+
"start": "node dist/cli.js",
|
|
64
|
+
"postinstall": "node dist/postinstall.js || true"
|
|
65
|
+
}
|
|
66
|
+
}
|